Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint lint: remove WARNS=3, falling back to the defa...



details:   https://anonhg.NetBSD.org/src/rev/8d81ca2d79d8
branches:  trunk
changeset: 961430:8d81ca2d79d8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Apr 18 22:51:24 2021 +0000

description:
lint: remove WARNS=3, falling back to the default WARNS=5

It's strange that GCC does not warn about the nonliteral format strings
in lint1/err.c, lint2/msg.c and lint2/read.c, despite -Wformat=2, but
Clang does.

diffstat:

 usr.bin/xlint/Makefile.inc   |  4 +---
 usr.bin/xlint/common/mem.c   |  6 +++---
 usr.bin/xlint/lint1/Makefile |  4 +++-
 usr.bin/xlint/lint1/main1.c  |  8 ++++----
 usr.bin/xlint/lint2/Makefile |  4 +++-
 usr.bin/xlint/lint2/main2.c  |  6 +++---
 usr.bin/xlint/lint2/read.c   |  6 +++---
 usr.bin/xlint/xlint/xlint.c  |  6 +++---
 8 files changed, 23 insertions(+), 21 deletions(-)

diffs (189 lines):

diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/Makefile.inc
--- a/usr.bin/xlint/Makefile.inc        Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/Makefile.inc        Sun Apr 18 22:51:24 2021 +0000
@@ -1,6 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.13 2013/01/28 14:25:18 matt Exp $
-
-WARNS?=                3       # XXX: fails -Wsign-compare
+#      $NetBSD: Makefile.inc,v 1.14 2021/04/18 22:51:24 rillig Exp $
 
 .include <bsd.own.mk>
 
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/common/mem.c
--- a/usr.bin/xlint/common/mem.c        Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/common/mem.c        Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.11 2020/12/29 11:35:11 rillig Exp $  */
+/*     $NetBSD: mem.c,v 1.12 2021/04/18 22:51:24 rillig Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.11 2020/12/29 11:35:11 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.12 2021/04/18 22:51:24 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -92,7 +92,7 @@
        return s2;
 }
 
-void
+void __attribute__((noreturn))
 nomem(void)
 {
 
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/lint1/Makefile
--- a/usr.bin/xlint/lint1/Makefile      Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/lint1/Makefile      Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.69 2021/04/18 21:53:37 rillig Exp $
+#      $NetBSD: Makefile,v 1.70 2021/04/18 22:51:24 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -25,6 +25,8 @@
 CPPFLAGS+=     -I${.CURDIR}
 CPPFLAGS+=     ${DEBUG:D-DDEBUG}
 
+COPTS.err.c+=  ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
+
 BINDIR=                /usr/libexec
 
 CLEANFILES+=   ${MAN}
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c       Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/lint1/main1.c       Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main1.c,v 1.44 2021/04/18 20:15:17 rillig Exp $        */
+/*     $NetBSD: main1.c,v 1.45 2021/04/18 22:51:24 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.44 2021/04/18 20:15:17 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.45 2021/04/18 22:51:24 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -290,7 +290,7 @@
        return nerr != 0 ? 1 : 0;
 }
 
-static void
+static void __attribute__((noreturn))
 usage(void)
 {
        (void)fprintf(stderr,
@@ -300,7 +300,7 @@
        exit(1);
 }
 
-void
+void __attribute__((noreturn))
 norecover(void)
 {
        /* cannot recover from previous errors */
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/lint2/Makefile
--- a/usr.bin/xlint/lint2/Makefile      Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/lint2/Makefile      Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.19 2021/04/10 18:36:27 rillig Exp $
+#      $NetBSD: Makefile,v 1.20 2021/04/18 22:51:24 rillig Exp $
 
 NOMAN=         # defined
 
@@ -8,4 +8,6 @@
 BINDIR=                /usr/libexec
 CPPFLAGS+=     -I${.CURDIR}
 
+COPTS.msg.c+=  ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
+
 .include <bsd.prog.mk>
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/lint2/main2.c
--- a/usr.bin/xlint/lint2/main2.c       Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/lint2/main2.c       Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main2.c,v 1.16 2021/04/18 20:15:17 rillig Exp $        */
+/*     $NetBSD: main2.c,v 1.17 2021/04/18 22:51:24 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.16 2021/04/18 20:15:17 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.17 2021/04/18 22:51:24 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -89,7 +89,7 @@
  */
 const char **libs;
 
-static void    usage(void);
+static void    usage(void) __attribute__((noreturn));
 
 int
 main(int argc, char *argv[])
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c        Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/lint2/read.c        Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.44 2021/04/18 21:12:50 rillig Exp $ */
+/* $NetBSD: read.c,v 1.45 2021/04/18 22:51:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: read.c,v 1.44 2021/04/18 21:12:50 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.45 2021/04/18 22:51:24 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -237,7 +237,7 @@
 }
 
 
-static void
+static void __attribute__((format(printf, 3, 4))) __attribute__((noreturn))
 inperror(const char *file, size_t line, const char *fmt, ...)
 {
        va_list ap;
diff -r 13eb6be2297e -r 8d81ca2d79d8 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Sun Apr 18 21:53:37 2021 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Sun Apr 18 22:51:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.61 2021/04/14 20:35:31 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.62 2021/04/18 22:51:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: xlint.c,v 1.61 2021/04/14 20:35:31 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.62 2021/04/18 22:51:25 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -306,7 +306,7 @@
        appstrg(lstp, concat3("-D__", def, "__"));
 }
 
-static void
+static void __attribute__((noreturn))
 usage(void)
 {
        const char *name;



Home | Main Index | Thread Index | Old Index