pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/compiler



Module Name:    pkgsrc
Committed By:   schmonz
Date:           Mon Sep 21 13:09:21 UTC 2020

Modified Files:
        pkgsrc/mk/compiler: clang.mk

Log Message:
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@


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/mk/compiler/clang.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/compiler/clang.mk
diff -u pkgsrc/mk/compiler/clang.mk:1.25 pkgsrc/mk/compiler/clang.mk:1.26
--- pkgsrc/mk/compiler/clang.mk:1.25    Fri Apr 17 13:36:26 2020
+++ pkgsrc/mk/compiler/clang.mk Mon Sep 21 13:09:21 2020
@@ -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 @@ CWRAPPERS_PREPEND.cc+=       -Qunused-argument
 _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