pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/compiler Xcode 12 (or its associated Command Line T...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/076d065de2a5
branches:  trunk
changeset: 439610:076d065de2a5
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Mon Sep 21 13:09:21 2020 +0000

description:
Xcode 12 (or its associated Command Line Tools) ships with default-on
-Werror=implicit-function-declaration, which will be great someday when
we're ready for it. Until then, on macOS, detect this situation and tell
the cc wrapper to prepend -Wno-error=implicit-function-declaration.

Taking mail/qmail as our example, this fixes the build on Catalina
with "Apple clang version 12.0.0 (clang-1200.0.32.2)". Adding
-Werror=implicit-function-declaration to CPPFLAGS or CFLAGS (in
mk.conf or on the command line) re-fails the build, as expected, with
a pile of "error: implicit declaration of function". Also as expected,
a full -Werror fails earlier on one of the many other problems with
qmail's code.

For clang on non-macOS platforms, no change.

clang-and-wrapper-ok: joerg@
during-the-freeze-ok: gdt@

diffstat:

 mk/compiler/clang.mk |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r b735db124904 -r 076d065de2a5 mk/compiler/clang.mk
--- a/mk/compiler/clang.mk      Mon Sep 21 08:48:39 2020 +0000
+++ b/mk/compiler/clang.mk      Mon Sep 21 13:09:21 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: clang.mk,v 1.25 2020/04/17 13:36:26 joerg Exp $
+# $NetBSD: clang.mk,v 1.26 2020/09/21 13:09:21 schmonz Exp $
 #
 # This is the compiler definition for the clang compiler.
 #
@@ -96,6 +96,16 @@
 _WRAP_EXTRA_ARGS.CXX+= -Qunused-arguments
 CWRAPPERS_APPEND.cxx+= -Qunused-arguments
 
+# Xcode 12 has a zealous new default. Turn it off until we're ready,
+# while allowing callers (or users, via CFLAGS/CPPFLAGS) to override.
+.if ${OPSYS} == "Darwin"
+_NOERROR_IMPLICIT_cmd= ${CCPATH} -\#\#\# -E -x c /dev/null 2>&1 \
+                       | ${GREP} -q Werror=implicit-function-declaration \
+                       && ${ECHO} -Wno-error=implicit-function-declaration \
+                       || ${TRUE}
+CWRAPPERS_PREPEND.cc+= ${_NOERROR_IMPLICIT_cmd:sh}
+.endif
+
 .for _version_ in ${_CXX_STD_VERSIONS}
 _CXX_STD_FLAG.${_version_}?=   -std=${_version_}
 .endfor



Home | Main Index | Thread Index | Old Index