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/gnu.inc.mk: set flags based on compiler version #18935

Merged
merged 1 commit into from
Nov 20, 2022

Conversation

benpicco
Copy link
Contributor

Contribution description

-fmacro-prefix-map was introduced in GCC 8, so only set it if the compiler version is 8 or newer.

Testing procedure

Issues/PRs references

#18913 (comment)

@benpicco benpicco requested a review from gschorcht as a code owner November 18, 2022 22:30
@benpicco benpicco requested review from aabadie and maribu November 18, 2022 22:30
@github-actions github-actions bot added Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms labels Nov 18, 2022
@benpicco benpicco force-pushed the makefiles/gnu-version branch from ca5269c to 998c4e9 Compare November 18, 2022 22:42
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 18, 2022
@riot-ci
Copy link

riot-ci commented Nov 19, 2022

Murdock results

✔️ PASSED

b30efee makefiles/gnu.inc.mk: set flags based on compiler version

Success Failures Total Runtime
117848 0 117848 02h:28m:25s

Artifacts

GCC_VERSION := $(shell $(CC) -dumpversion)

# -fmacro-prefix-map requires GCC 8
ifneq (8, $(firstword $(shell echo "8\n$(GCC_VERSION)" | sort -V))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not portable, as replacing \n with a newline character is not POSIX standard. Bash will do so, but not e.g. ash. Also, -V seems not to not work with all implementations of sort.

Copy link
Contributor Author

@benpicco benpicco Nov 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope it's portable now - is there an easy way to check this?

@benpicco benpicco force-pushed the makefiles/gnu-version branch from 998c4e9 to b30efee Compare November 19, 2022 22:15
# 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 Area: toolchain Area: toolchains; everything related to compilation, libc, linking, … 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants