Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
843cec5c
Unverified
Commit
843cec5c
authored
6 years ago
by
Joakim Nohlgård
Committed by
Gaëtan Harter
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
makefiles/cflags.inc.mk: Use a template for CFLAGS testing
parent
a71ef652
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
makefiles/cflags.inc.mk
+9
-7
9 additions, 7 deletions
makefiles/cflags.inc.mk
with
9 additions
and
7 deletions
makefiles/cflags.inc.mk
+
9
−
7
View file @
843cec5c
...
@@ -25,21 +25,23 @@ ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null
...
@@ -25,21 +25,23 @@ ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null
endif
endif
endif
endif
# Template for testing a compiler flag and adding it to CFLAGS (errors usually
# happens when using older toolchains which do not support the given flags)
define
cflags_test_and_add
ifeq
($(shell $(CC) $(1) -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
CFLAGS
+=
$(
1
)
endif
endef
# Use colored compiler output if the compiler supports this and if this is not
# Use colored compiler output if the compiler supports this and if this is not
# disabled by the user
# disabled by the user
ifeq
($(CC_NOCOLOR),0)
ifeq
($(CC_NOCOLOR),0)
ifeq
($(shell $(CC) -fdiagnostics-color -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
$(
eval
$(
call cflags_test_and_add,-fdiagnostics-color
))
CFLAGS
+=
-fdiagnostics-color
endif
endif
endif
# Fast-out on old style function definitions.
# Fast-out on old style function definitions.
# They cause unreadable error compiler errors on missing semicolons.
# They cause unreadable error compiler errors on missing semicolons.
# Worse yet they hide errors by accepting wildcard argument types.
# Worse yet they hide errors by accepting wildcard argument types.
ifeq
($(shell $(CC) -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
$(
foreach
flag,-Wstrict-prototypes
-Wold-style-definition
,
$(
eval
$(
call cflags_test_and_add,
$(
flag
))))
# duplicated parameters don't hurt
CFLAGS
+=
-Wstrict-prototypes
-Wold-style-definition
endif
# Unwanted flags for c++
# Unwanted flags for c++
CXXUWFLAGS
+=
-std
=
%
CXXUWFLAGS
+=
-std
=
%
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment