Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

makefiles/cflags.inc.mk: don't include absolute path in __FILE__ macro #18913

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

benpicco
Copy link
Contributor

Contribution description

__FILE__ will resolve to the absolute path of the file.
This adds a lot of noise (and ROM size) when debugging with tracer macros.

Luckily, starting with GCC 8 we can drop the common $(RIOTBASE) prefix, this makes for much nicer output.

Testing procedure

Used in e.g. #18795

Issues/PRs references

@github-actions github-actions bot added Area: build system Area: Build system Platform: AVR Platform: This PR/issue effects AVR-based platforms labels Nov 15, 2022
@benpicco benpicco requested a review from maribu November 15, 2022 14:31
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Nov 15, 2022
@benpicco benpicco requested a review from aabadie November 15, 2022 14:33
@benpicco benpicco removed the Platform: AVR Platform: This PR/issue effects AVR-based platforms label Nov 15, 2022
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 15, 2022
This requires at least GCC 8
@benpicco benpicco requested a review from gschorcht as a code owner November 15, 2022 19:40
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms labels Nov 15, 2022
@riot-ci
Copy link

riot-ci commented Nov 15, 2022

Murdock results

✔️ PASSED

5b35910 cpu/esp8266: blacklist -fmacro-prefix-map

Success Failures Total Runtime
117848 0 117848 01h:45m:42s

Artifacts

@benpicco benpicco merged commit e1aa925 into RIOT-OS:master Nov 18, 2022
@benpicco benpicco deleted the macro-prefix-map branch November 18, 2022 15:43
@krzysztof-cabaj
Copy link
Contributor

I use on my old debian arm-none-eabi-gcc version 7.3.1. Addition to OPTIONAL_CFLAG the -fmacro-prefix-map=$(RIOTBASE)/= breaks ability to compile any RIOT program. I receive error:

tests/periph_pwm$ make BOARD=nucleo-l552ze-q
Building application "tests_periph_pwm" for "nucleo-l552ze-q" with MCU "stm32".

arm-none-eabi-gcc: error: unrecognized command line option '-fmacro-prefix-map=/data/RIOT-public/RIOT/='

Is that version of the compiler no longer supported by RIOT?

@benpicco
Copy link
Contributor Author

benpicco commented Nov 18, 2022

Is that version of the compiler no longer supported by RIOT?

Arg, Debian stable ships GCC 8 and the previous Ubuntu LTS GCC 9 so there is a temptation to say yes.

But then again we should just properly detect the compiler version (so we don't penalize users who have a recent avr-gcc just because the Debian package is orphaned).

For now, just add

OPTIONAL_CFLAGS_BLACKLIST += -fmacro-prefix-map=$(RIOTBASE)/=

if you can't update your system.

@krzysztof-cabaj
Copy link
Contributor

Probably adding some if to makefiles which automatically disable this flag for older compilers is wasting a time and only mess makefiles.

I think this is a good time (and reason) to system update.

@benpicco
Copy link
Contributor Author

Can you try #18935

@krzysztof-cabaj
Copy link
Contributor

krzysztof-cabaj commented Nov 18, 2022

PR #18935 works with my old arm-none-eabi-gcc 7.3.1.

Thanks for this PR!

@miri64
Copy link
Member

miri64 commented Nov 18, 2022

This makes RIOT_FILE_RELATIVE obsolete btw (and since it is also faulty, as it always will use the c-file, even for includes), I guess it can be deprecated and removed now?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: build system Area: Build system Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants