Skip to content

Commit e123d3a

Browse files
committed
makefile: update CPPFLAGS & CFLAGS
1. _FORTIFY_SOURCE is defined built-in by certian build of gcc (such as Gentoo in Hardened profile), so undefine the define to slience warnings like: <command-line>: warning: "_FORTIFY_SOURCE" redefined <built-in>: note: this is the location of the previous definition 2. -Wno-unknown-warning-option & -Wno-gnu-alignof-expression are available for clang only, but "-fplan9-extensions" is used which is gcc only! So remove these two warning options to avoid: cc1: note: unrecognized command-line option ‘-Wno-gnu-alignof-expression’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics Signed-off-by: Z. Liu <[email protected]>
1 parent 16f37fc commit e123d3a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ LIBGO_SYMLINK := $(LIBGO_NAME).so
136136
##### Flags definitions #####
137137

138138
# Common flags
139-
CPPFLAGS := -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 $(CPPFLAGS)
139+
CPPFLAGS := -D_GNU_SOURCE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $(CPPFLAGS)
140140
CFLAGS := -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fplan9-extensions -fstack-protector -fno-strict-aliasing -fvisibility=hidden \
141141
-Wall -Wextra -Wcast-align -Wpointer-arith -Wmissing-prototypes -Wnonnull \
142142
-Wwrite-strings -Wlogical-op -Wformat=2 -Wmissing-format-attribute -Winit-self -Wshadow \
143143
-Wstrict-prototypes -Wunreachable-code -Wconversion -Wsign-conversion \
144-
-Wno-unknown-warning-option -Wno-format-extra-args -Wno-gnu-alignof-expression $(CFLAGS)
144+
-Wno-format-extra-args $(CFLAGS)
145145
LDFLAGS := -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--gc-sections $(LDFLAGS)
146146
LDLIBS := $(LDLIBS)
147147

mk/elftoolchain.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ COMMON := $(SRCS_DIR)/common
2727

2828
##### Flags definitions #####
2929

30-
export CPPFLAGS := -D_FORTIFY_SOURCE=2
30+
export CPPFLAGS := -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3131
export CFLAGS := -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC
3232

3333
##### Private rules #####

mk/libtirpc.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LIBTIRPC := $(SRCS_DIR)/libtirpc
1515

1616
##### Flags definitions #####
1717

18-
export CPPFLAGS := -D_FORTIFY_SOURCE=2
18+
export CPPFLAGS := -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
1919
export CFLAGS := -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC
2020

2121
##### Private rules #####

mk/nvidia-modprobe.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PATCH_FILE := $(MAKE_DIR)/nvidia-modprobe.patch
2424
##### Flags definitions #####
2525

2626
ARFLAGS := -rU
27-
CPPFLAGS := -D_FORTIFY_SOURCE=2 -DNV_LINUX
27+
CPPFLAGS := -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DNV_LINUX
2828
CFLAGS := -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC
2929

3030
##### Private rules #####

0 commit comments

Comments
 (0)