Source-Changes-HG archive

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

[src/trunk]: src lint: repurpose the '-d' option to specify DESTDIR



details:   https://anonhg.NetBSD.org/src/rev/fc0a87a684d9
branches:  trunk
changeset: 373160:fc0a87a684d9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 22 15:20:01 2023 +0000

description:
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.

diffstat:

 share/mk/bsd.sys.mk         |   4 ++--
 usr.bin/xlint/xlint/lint.1  |  10 +++++-----
 usr.bin/xlint/xlint/xlint.c |   7 +++----
 3 files changed, 10 insertions(+), 11 deletions(-)

diffs (77 lines):

diff -r 274704326e10 -r fc0a87a684d9 share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk       Sun Jan 22 14:35:10 2023 +0000
+++ b/share/mk/bsd.sys.mk       Sun Jan 22 15:20:01 2023 +0000
@@ -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 @@
 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
diff -r 274704326e10 -r fc0a87a684d9 usr.bin/xlint/xlint/lint.1
--- a/usr.bin/xlint/xlint/lint.1        Sun Jan 22 14:35:10 2023 +0000
+++ b/usr.bin/xlint/xlint/lint.1        Sun Jan 22 15:20:01 2023 +0000
@@ -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 @@
 .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
diff -r 274704326e10 -r fc0a87a684d9 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Sun Jan 22 14:35:10 2023 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Sun Jan 22 15:20:01 2023 +0000
@@ -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 @@
                        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;
 



Home | Main Index | Thread Index | Old Index