File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,27 @@ cppcheck_suppressions() {
68
68
printf " %s" " $out " | sed ' s/[[:space:]]*$//'
69
69
}
70
70
71
+ # Generation of standard compliance for GCC/Clang
72
+ detect_cc_std () {
73
+ local STDC_VERSION=" "
74
+ local EXTRA_DEFINES=" "
75
+ if command -v cc > /dev/null 2>&1 ; then
76
+ if cc --version 2> /dev/null | grep -q " clang" ; then
77
+ STDC_VERSION=$( cc -dM -E -xc /dev/null | awk ' /__STDC_VERSION__/ {print $3}' )
78
+ EXTRA_DEFINES=" -D__clang__=1"
79
+ elif cc --version 2> /dev/null | grep -q " Free Software Foundation" ; then
80
+ STDC_VERSION=$( cc -dM -E -xc /dev/null | awk ' /__STDC_VERSION__/ {print $3}' )
81
+ EXTRA_DEFINES=" -D__GNUC__=1"
82
+ fi
83
+ fi
84
+ if [ -n " $STDC_VERSION " ]; then
85
+ EXTRA_DEFINES+=" -D__STDC__=1 -D__STDC_VERSION__=${STDC_VERSION} "
86
+ fi
87
+ echo " $EXTRA_DEFINES "
88
+ }
89
+
71
90
CPPCHECK_OPTS=" -I. --enable=all --error-exitcode=1"
91
+ CPPCHECK_OPTS+=" $( detect_cc_std) "
72
92
CPPCHECK_OPTS+=" --force $( cppcheck_suppressions) $( cppcheck_build_unmatched) "
73
93
CPPCHECK_OPTS+=" --cppcheck-build-dir=.out ."
74
94
You can’t perform that action at this time.
0 commit comments