2
2
# Otherwise test if the compiler unterstands the "-std=gnu99" flag, and use it if so.
3
3
# Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so.
4
4
ifeq ($(filter -std=%,$(CFLAGS)),)
5
- ifeq ($(shell $(CC) -std=gnu99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
6
- CFLAGS += -std=gnu99
7
- else
8
- ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
9
- CFLAGS += -std=c99
10
- endif
11
- endif
5
+ ifeq ($(shell $(CC) -std=gnu99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
6
+ CFLAGS += -std=gnu99
7
+ else
8
+ ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
9
+ CFLAGS += -std=c99
10
+ endif
11
+ endif
12
12
endif
13
13
14
14
# Add `-fno-delete-null-pointer-checks` flag iff the compiler supports it.
@@ -17,18 +17,27 @@ endif
17
17
# Right now clang does not use the *delete-null-pointer* optimization, and does not understand the parameter.
18
18
# Related issues: #628, #664.
19
19
ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
20
- ifeq ($(shell LANG=C $(CC) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
21
- CFLAGS += -fno-delete-null-pointer-checks
22
- endif
20
+ ifeq ($(shell LANG=C $(CC) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
21
+ CFLAGS += -fno-delete-null-pointer-checks
22
+
23
+ ifneq ($(shell $(CXX) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
24
+ CXXUWFLAGS += -fno-delete-null-pointer-checks
25
+ else
26
+ ifneq ($(shell LANG=C $(CXX) -fno-delete-null-pointer-checks -E - 2>&1 1>/dev/null </dev/null | grep warning: | grep -- -fno-delete-null-pointer-checks),)
27
+ CXXUWFLAGS += -fno-delete-null-pointer-checks
28
+ endif
29
+ endif
30
+ endif
23
31
endif
24
32
25
33
# Fast-out on old style function definitions.
26
34
# They cause unreadable error compiler errors on missing semicolons.
27
35
# Worse yet they hide errors by accepting wildcard argument types.
28
36
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)
29
- # duplicated parameters don't hurt
30
- CFLAGS += -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition
37
+ # duplicated parameters don't hurt
38
+ CFLAGS += -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition
39
+ CXXUWFLAGS += -Wstrict-prototypes -Wold-style-definition
31
40
endif
32
41
33
42
# Unwanted flags for c++
34
- CXXUWFLAGS += -std=gnu99 -std=c99 -Wstrict-prototypes -Wold-style-definition
43
+ CXXUWFLAGS += -std=%
0 commit comments