Module Name: src
Committed By: rillig
Date: Sun Jan 22 15:20:01 UTC 2023
Modified Files:
src/share/mk: bsd.sys.mk
src/usr.bin/xlint/xlint: lint.1 xlint.c
Log Message:
lint: repurpose the '-d' option to specify DESTDIR
Previously, passing '-nostdinc -isystem $dir' only searched the given
directory but not any compiler-specific directories.
Discovered by fontconfig, which includes <stdatomic.h> from C11, which
lives in /usr/include/gcc-10 instead of /usr/include.
Change the preprocessor options to '--sysroot' instead, to align them
with how the compiler is invoked using build.sh.
To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/xlint/lint.1
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/xlint/xlint.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.311 src/share/mk/bsd.sys.mk:1.312
--- src/share/mk/bsd.sys.mk:1.311 Fri Jan 6 15:48:29 2023
+++ src/share/mk/bsd.sys.mk Sun Jan 22 15:20:01 2023
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.sys.mk,v 1.311 2023/01/06 15:48:29 christos Exp $
+# $NetBSD: bsd.sys.mk,v 1.312 2023/01/22 15:20:01 rillig Exp $
#
# Build definitions used for NetBSD source tree builds.
@@ -163,7 +163,7 @@ CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}}
CPPFLAGS+= ${AUDIT:D-D__AUDIT__}
_NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no}
CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS}
-LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include}
+LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}}
.if !defined(NOSSP) && (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec")
. if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels / kern modules
Index: src/usr.bin/xlint/xlint/lint.1
diff -u src/usr.bin/xlint/xlint/lint.1:1.55 src/usr.bin/xlint/xlint/lint.1:1.56
--- src/usr.bin/xlint/xlint/lint.1:1.55 Sat Oct 1 09:42:40 2022
+++ src/usr.bin/xlint/xlint/lint.1 Sun Jan 22 15:20:01 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: lint.1,v 1.55 2022/10/01 09:42:40 rillig Exp $
+.\" $NetBSD: lint.1,v 1.56 2023/01/22 15:20:01 rillig Exp $
.\"
.\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
.\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -30,7 +30,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 5, 2022
+.Dd January 21, 2023
.Dt LINT 1
.Os
.Sh NAME
@@ -239,9 +239,9 @@ is defined as 1.
.It Fl d Ns Ar directory
Use
.Ar directory
-instead of
-.Pa /usr/include
-as the default place to find include files.
+as the root directory
+.Pq Va DESTDIR
+to find include files.
.It Fl e
Complain about unusual operations on
.Sy enum
Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.107 src/usr.bin/xlint/xlint/xlint.c:1.108
--- src/usr.bin/xlint/xlint/xlint.c:1.107 Sat Jan 21 11:29:30 2023
+++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 22 15:20:01 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.107 2023/01/21 11:29:30 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.108 2023/01/22 15:20:01 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.107 2023/01/21 11:29:30 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.108 2023/01/22 15:20:01 rillig Exp $");
#endif
#include <sys/param.h>
@@ -512,8 +512,7 @@ main(int argc, char *argv[])
if (dflag)
usage("%c flag already specified", 'd');
dflag = true;
- list_add(&cpp.flags, "-nostdinc");
- list_add(&cpp.flags, "-isystem");
+ list_add(&cpp.flags, "--sysroot");
list_add(&cpp.flags, optarg);
break;