|
1 | | -# $NetBSD: clang.mk,v 1.42 2023/10/18 08:48:51 jperkin Exp $ |
| 1 | +# $NetBSD: clang.mk,v 1.43 2024/03/19 21:12:47 schmonz Exp $ |
2 | 2 | # |
3 | 3 | # This is the compiler definition for the clang compiler. |
4 | 4 | # |
@@ -80,15 +80,44 @@ CWRAPPERS_PREPEND.cc+= -Qunused-arguments |
80 | 80 | _WRAP_EXTRA_ARGS.CXX+= -Qunused-arguments |
81 | 81 | CWRAPPERS_APPEND.cxx+= -Qunused-arguments |
82 | 82 |
|
83 | | -# Xcode 12 has a zealous new default. Turn it off until we're ready, |
84 | | -# while allowing callers (or users, via CFLAGS/CPPFLAGS) to override. |
85 | | -.if ${OPSYS} == "Darwin" |
86 | | -_NOERROR_IMPLICIT_cmd= ${CCPATH} -\#\#\# -E -x c /dev/null 2>&1 \ |
| 83 | +# Xcode 12 and upstream Clang 16 have a zealous new default that the |
| 84 | +# wide world of random third-party software isn't ready for. Turn it |
| 85 | +# back off by default. |
| 86 | +# |
| 87 | +# Packages and users can override via CFLAGS/CPPFLAGS. |
| 88 | +_NOERROR_IMPLICIT_cmd= ${CCPATH} -\#\#\# -E -x c /dev/null \ |
| 89 | + 2>&1 \ |
87 | 90 | | ${GREP} -q Werror=implicit-function-declaration \ |
88 | 91 | && ${ECHO} -Wno-error=implicit-function-declaration \ |
89 | 92 | || ${TRUE} |
90 | 93 | CWRAPPERS_PREPEND.cc+= ${_NOERROR_IMPLICIT_cmd:sh} |
91 | | -.endif |
| 94 | + |
| 95 | +# Xcode 15 (Apple clang-1500.3.9.4) and upstream Clang 16 have several |
| 96 | +# more zealous new defaults. We can't default them off as precisely |
| 97 | +# (they don't show up in `clang -###` output), so we simply attempt to |
| 98 | +# turn them off for any clang that doesn't complain when we try. |
| 99 | +# |
| 100 | +# Packages and users can override via CFLAGS/CPPFLAGS. |
| 101 | +# |
| 102 | +# As soon as 2024Q1 branches, we should: |
| 103 | +# |
| 104 | +# 1. Do a bulk build with all these -Wno-error tweaks removed, so we can |
| 105 | +# see how much is broken. |
| 106 | +# 2. If it's "too much" breakage and we'll have to keep overriding these |
| 107 | +# compiler defaults for "a while", find a way to accomplish them with |
| 108 | +# fewer compiler invocations. (Some ideas: define a default |
| 109 | +# FORCE_C_STD, or apply overrides keyed on CC_VERSION or similar.) Do |
| 110 | +# a bulk build to make sure things continue to work as before. |
| 111 | +# 3. Otherwise, fix as much as we can before 2024Q2. This will help with |
| 112 | +# gcc 14 (which has many similar new defaults) as well. |
| 113 | +_WERROR_CLANG16= implicit-int int-conversion incompatible-pointer-types |
| 114 | +_NOERROR_CLANG16_cmd= for _warn_ in ${_WERROR_CLANG16}; do \ |
| 115 | + ${CCPATH} -\#\#\# -Wno-error=$${_warn_} -x c /dev/null \ |
| 116 | + >/dev/null 2>&1 \ |
| 117 | + && ${ECHO} -Wno-error=$${_warn_} \ |
| 118 | + || ${TRUE}; \ |
| 119 | + done |
| 120 | +CWRAPPERS_PREPEND.cc+= ${_NOERROR_CLANG16_cmd:sh} |
92 | 121 |
|
93 | 122 | .for _version_ in ${_CXX_STD_VERSIONS} |
94 | 123 | _CXX_STD_FLAG.${_version_}?= -std=${_version_} |
|
0 commit comments