Lines Matching +full:clang +full:- +full:format
6 # overridden (e.g. if using a non-gcc compiler) by defining MK_WARNS=no.
8 # for GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
9 # for clang: https://clang.llvm.org/docs/DiagnosticsReference.html
17 CFLAGS+= -std=iso9899:1990
19 CFLAGS+= -std=iso9899:199409
21 CFLAGS+= -std=iso9899:1999
23 CFLAGS+= -std=${CSTD}
27 CXXFLAGS+= -std=${CXXSTD}
30 # This gives the Makefile we're evaluating at the top-level a chance to set
38 # -pedantic is problematic because it also imposes namespace restrictions
39 #CFLAGS+= -pedantic
42 CWARNFLAGS+= -Wsystem-headers
44 CWARNFLAGS+= -Werror
48 CWARNFLAGS+= -Wall -Wno-format-y2k
51 CWARNFLAGS+= -W -Wno-unused-parameter
52 .if ${COMPILER_TYPE} == "clang"
53 CWARNFLAGS+= -Wstrict-prototypes
55 CWARNFLAGS+= -Wmissing-prototypes -Wpointer-arith
58 CWARNFLAGS+= -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow\
59 -Wunused-parameter
61 CWARNFLAGS+= -Wcast-align
65 CWARNFLAGS+= -Wchar-subscripts -Wnested-externs \
66 -Wold-style-definition
68 CWARNFLAGS.clang+= -Wmissing-variable-declarations
71 CWARNFLAGS.clang+= -Wthread-safety
75 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
77 CWARNFLAGS+= -Wno-uninitialized
79 CWARNFLAGS+= -Wno-pointer-sign
81 CWARNFLAGS+= -Wdate-time
83 # Clang has more warnings enabled by default, and when using -Wall, so if WARNS
86 CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int
87 CWARNFLAGS.clang+= -Wno-unused-const-variable
88 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000
89 CWARNFLAGS.clang+= -Wno-error=unused-but-set-parameter
91 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 190000
92 # Similar to gcc >= 8.1 -Wno-error=cast-function-type below
93 CWARNFLAGS.clang+= -Wno-error=cast-function-type-mismatch
97 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\
98 -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion
99 CWARNFLAGS.clang+= -Wno-unused-local-typedef
100 CWARNFLAGS.clang+= -Wno-address-of-packed-member
102 CWARNFLAGS.gcc+= -Wno-address-of-packed-member
106 CWARNFLAGS.clang+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter
109 CWARNFLAGS.clang+= -Wno-parentheses
112 CWARNFLAGS.clang+= -Wno-array-bounds
115 ((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 100000) || \
117 CWARNFLAGS+= -Wno-misleading-indentation
120 NO_WUNUSED_BUT_SET_VARIABLE= -Wno-unused-but-set-variable
122 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 140000
123 NO_WBITWISE_INSTEAD_OF_LOGICAL= -Wno-bitwise-instead-of-logical
125 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 150000
126 NO_WARRAY_PARAMETER= -Wno-array-parameter
127 NO_WSTRICT_PROTOTYPES= -Wno-strict-prototypes
128 NO_WDEPRECATED_NON_PROTOTYPE=-Wno-deprecated-non-prototype
131 NO_WUNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
134 NO_WZERO_LENGTH_BOUNDS= -Wno-zero-length-bounds
137 NO_WARRAY_PARAMETER= -Wno-array-parameter
140 NO_WUSE_AFTER_FREE= -Wno-use-after-free
141 NO_WDANGLING_POINTER= -Wno-dangling-pointer
150 #CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
151 CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args
153 CWARNFLAGS.clang+= -Wno-format-nonliteral
156 CWARNFLAGS+= -Werror
161 CWARNFLAGS+= -Wno-format
173 CWARNFLAGS+= -Wno-error=address \
174 -Wno-error=array-bounds \
175 -Wno-error=attributes \
176 -Wno-error=bool-compare \
177 -Wno-error=cast-align \
178 -Wno-error=clobbered \
179 -Wno-error=deprecated-declarations \
180 -Wno-error=enum-compare \
181 -Wno-error=extra \
182 -Wno-error=logical-not-parentheses \
183 -Wno-error=strict-aliasing \
184 -Wno-error=uninitialized \
185 -Wno-error=unused-function \
186 -Wno-error=unused-value
191 CWARNFLAGS+= -Wno-error=empty-body \
192 -Wno-error=maybe-uninitialized \
193 -Wno-error=nonnull-compare \
194 -Wno-error=shift-negative-value \
195 -Wno-error=tautological-compare \
196 -Wno-error=unused-const-variable
201 CWARNFLAGS+= -Wno-error=bool-operation \
202 -Wno-error=deprecated \
203 -Wno-error=expansion-to-defined \
204 -Wno-error=format-overflow \
205 -Wno-error=format-truncation \
206 -Wno-error=implicit-fallthrough \
207 -Wno-error=int-in-bool-context \
208 -Wno-error=memset-elt-size \
209 -Wno-error=noexcept-type \
210 -Wno-error=nonnull \
211 -Wno-error=pointer-compare \
212 -Wno-error=stringop-overflow
217 CWARNFLAGS+= -Wno-error=aggressive-loop-optimizations \
218 -Wno-error=cast-function-type \
219 -Wno-error=catch-value \
220 -Wno-error=multistatement-macros \
221 -Wno-error=restrict \
222 -Wno-error=sizeof-pointer-memaccess \
223 -Wno-error=stringop-truncation
224 CXXWARNFLAGS+= -Wno-error=class-memaccess
230 CWARNFLAGS+= -Wno-error=overflow
238 CXXWARNFLAGS+= -Wno-literal-suffix \
239 -Wno-error=unknown-pragmas
246 CXXWARNFLAGS+= -Wno-dangling-reference
251 CWARNFLAGS+= -Wno-return-type
255 CWARNFLAGS+= -Wno-system-headers
259 # How to handle FreeBSD custom printf format specifiers.
260 .if ${COMPILER_TYPE} == "clang" || \
262 FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
264 FORMAT_EXTENSIONS= -fformat-extensions
268 CWARNFLAGS+= -Wno-unknown-pragmas
272 CFLAGS+= -Wno-format-zero-length
274 .if ${COMPILER_TYPE} == "clang"
275 # The headers provided by clang are incompatible with the FreeBSD headers.
276 # If the version of clang is not one that has been patched to omit the
277 # incompatible headers, we need to compile with -nobuiltininc and add the
281 # XXX: This is a hack to support complete external installs of clang while
282 # we work to synchronize our decleration guards with those in the clang tree.
285 CFLAGS+=-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include
289 CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3
291 CLANG_OPT_SMALL+= -mllvm -simplifycfg-dup-ret
293 CLANG_OPT_SMALL+= -mllvm -enable-load-pre=false
294 CFLAGS.clang+= -Qunused-arguments
300 CXXFLAGS.clang+= -Wno-c++11-extensions
306 # Don't use -Wstack-protector as it breaks world with -Werror.
307 SSP_CFLAGS?= -fstack-protector-strong
311 CFLAGS+= -D_FORTIFY_SOURCE=${FORTIFY_SOURCE}
312 CXXFLAGS+= -D_FORTIFY_SOURCE=${FORTIFY_SOURCE}
317 DEBUG_FILES_CFLAGS?= -g -gz=zlib
319 # Allow user-specified additional warning flags, plus compiler and file
344 # Some directories (currently just clang) also need to disable this since
346 # in the same namespace, meaning that, for example, GCC builds of clang pick up
347 # CFLAGS.clang via CFLAGS.${.TARGET:T} and thus try to pass Clang-specific
362 # Prevent rebuilding during install to support read-only objdirs.
364 CFLAGS+= ERROR-tried-to-rebuild-during-make-install
370 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
371 .if ${COMPILER_TYPE} == "clang"
372 # Note: Clang does not like relative paths for ld so we map ld.lld -> lld.
374 LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W}
376 LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
379 # GCC does not support an absolute path for -fuse-ld so we just print this
381 # However, we can avoid this warning if -B is set appropriately (e.g. for
382 # CROSS_TOOLCHAIN=...-gcc).
383 .if !(${LD:[1]:T} == "ld" && ${CC:tw:M-B${LD:[1]:H}/})
384 .warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported
390 # or expect to ever be up-to-date.
392 beforelinking build build-tools buildconfig buildfiles \