Powered by Linux
[PATCH] Set __STDC_VERSION__ for std89 — Semantic Matching Tool

[PATCH] Set __STDC_VERSION__ for std89

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When kernel is compiled with clang and smatch is used for checking,
option -std=gnu89 is used and STDC_VERSION is not defined, causing
the following warnings for every file checked:

/usr/lib64/clang/11.0.0/include/stdarg.h:26:36: warning: undefined
preprocessor identifier '__cplusplus'
/usr/lib64/clang/11.0.0/include/stdarg.h:26:5: warning: undefined
preprocessor identifier '__STDC_VERSION__'

option used:
smatch -p=kernel --data=/usr/share/smatch/smatch_data --debug-implied
--succeed -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
-Wno-return-void -Wno-unknown-attribute  -D__x86_64__ --arch=x86_64
-mlittle-endian -m64 -Wp,-MD,arch/x86/kernel/cpu/mtrr/.mtrr.o.d
-nostdinc -isystem /usr/lib64/clang/11.0.0/include
-I<SRC>arch/x86/include -I./arch/x86/include/generated
 -I<SRC>include -I./include -I<SRC>arch/x86/include/uapi
-I./arch/x86/include/generated/uapi -I<SRC>include/uapi
-I./include/generated/uapi -include <SRC>include/linux/kconfig.h
-include <SRC>include/linux/compiler_type
s.h -D__KERNEL__ -Qunused-arguments -Wall -Wundef
-Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration
-Werror=implicit-int -Wno-format-security -std=gnu89
--target=x86_64-cros-linux-gnu --prefix=/usr/bin/ --gcc-toolchain=/usr
-no-integrated-as -Werror=unknown-warning-option -mno-sse -mno-mmx
-mno-sse2 -mno-3dnow -mno-avx -m64 -mno-803
87 -mstack-alignment=8 -mtune=generic -mno-red-zone -mcmodel=kernel
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1
-DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1
-DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare
-fno-asynchronous-unwind-tables -mretpoline-external-thunk
-fno-delete-null-pointer-checks -Wno-frame-address
-Wno-address-of-packed-member -Os --param=allow-store-data-races=0 -Wframe-larger-than=2048
-fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu
-Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable
-ftrivial-auto-var-init=pattern -g -pg -mfentry -DCC_USING_FENTRY
-Werror -Wdeclaration-after-statement -Wvla -Wno-pointer-sign
-Wno-array-bounds -fno-strict-overflow -fno-merge-all-constants
-fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types
-fmacro-prefix-map=<SRC>=
-fcf-protection=none -Wno-initializer-overrides -Wno-format
-Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast
-fdebug-info-for-profiling -I<SRC>arch/x86/kernel/cpu/mtrr
-I ./arch/x86/kernel/cpu/mtrr -DKBUILD_BASENAME='"mtrr"'
-DKBUILD_MODNAME='"mtrr"' <SRC>arch/x86/kernel/cpu/mtrr/mtrr.c

Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
---
 lib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib.c b/lib.c
index ad71f08e..4dd0c8e5 100644
--- a/lib.c
+++ b/lib.c
@@ -1229,6 +1229,7 @@ static void predefined_macros(void)
 		break;
 
 	case STANDARD_GNU89:
+		predefine("__STDC_VERSION__", 1, "199901L");
 	default:
 		break;
 
-- 
2.28.0.rc0.142.g3c755180ce-goog




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux