Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: in C99 mode, only warn about impli...



details:   https://anonhg.NetBSD.org/src/rev/aa88a717ebf8
branches:  trunk
changeset: 984288:aa88a717ebf8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 30 14:32:41 2021 +0000

description:
lint: in C99 mode, only warn about implicit function declarations

Since tree.c 1.294 from 2021-06-28 (two days ago), lint errored out on
an implicit function declaration.  In principle it is correct to do so
since C99 requires it, but in practice there are a several functions
that are not declared in the translation unit itself since they are
provided by the compiler.  Typical examples for GCC and Clang are the
various functions named '__builtin_*' and '__atomic_*'.

For now, only warn about these but don't error out.

diffstat:

 tests/usr.bin/xlint/lint1/msg_155.exp |  2 +-
 tests/usr.bin/xlint/lint1/msg_215.c   |  4 ++--
 tests/usr.bin/xlint/lint1/msg_215.exp |  2 +-
 usr.bin/xlint/lint1/tree.c            |  6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r 9f197786c8e5 -r aa88a717ebf8 tests/usr.bin/xlint/lint1/msg_155.exp
--- a/tests/usr.bin/xlint/lint1/msg_155.exp     Wed Jun 30 14:23:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_155.exp     Wed Jun 30 14:32:41 2021 +0000
@@ -3,7 +3,7 @@
 msg_155.c(32): warning: passing 'struct incompatible' to incompatible 'pointer to pointer to int', arg #1 [155]
 msg_155.c(35): warning: passing 'struct incompatible' to incompatible 'pointer to array[3] of int', arg #1 [155]
 msg_155.c(38): warning: passing 'struct incompatible' to incompatible 'pointer to array[unknown_size] of int', arg #1 [155]
-msg_155.c(42): error: function 'c99_6_7_6_example_f' implicitly declared to return int [215]
+msg_155.c(42): warning: function 'c99_6_7_6_example_f' implicitly declared to return int [215]
 msg_155.c(45): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
 msg_155.c(48): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
 msg_155.c(69): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
diff -r 9f197786c8e5 -r aa88a717ebf8 tests/usr.bin/xlint/lint1/msg_215.c
--- a/tests/usr.bin/xlint/lint1/msg_215.c       Wed Jun 30 14:23:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_215.c       Wed Jun 30 14:32:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_215.c,v 1.7 2021/06/30 14:23:50 rillig Exp $       */
+/*     $NetBSD: msg_215.c,v 1.8 2021/06/30 14:32:41 rillig Exp $       */
 # 3 "msg_215.c"
 
 // Test for message: function '%s' implicitly declared to return int [215]
@@ -17,7 +17,7 @@
 void
 test(struct str str)
 {
-       /* expect+1: error: function 'name' implicitly declared to return int [215] */
+       /* expect+1: warning: function 'name' implicitly declared to return int [215] */
        name();
 
        /* expect+2: error: 'parenthesized' undefined [99] */
diff -r 9f197786c8e5 -r aa88a717ebf8 tests/usr.bin/xlint/lint1/msg_215.exp
--- a/tests/usr.bin/xlint/lint1/msg_215.exp     Wed Jun 30 14:23:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_215.exp     Wed Jun 30 14:32:41 2021 +0000
@@ -1,4 +1,4 @@
-msg_215.c(21): error: function 'name' implicitly declared to return int [215]
+msg_215.c(21): warning: function 'name' implicitly declared to return int [215]
 msg_215.c(25): error: 'parenthesized' undefined [99]
 msg_215.c(25): error: illegal function (type int) [149]
 msg_215.c(29): error: type 'struct str' does not have member 'member' [101]
diff -r 9f197786c8e5 -r aa88a717ebf8 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Wed Jun 30 14:23:50 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Wed Jun 30 14:32:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.301 2021/06/30 14:23:50 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.301 2021/06/30 14:23:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -247,7 +247,7 @@
                if (follow_token == T_LPAREN) {
                        if (Sflag) {
                                /* function '%s' implicitly declared to ... */
-                               error(215, sym->s_name);
+                               warning(215, sym->s_name);
                        } else if (sflag) {
                                /* function '%s' implicitly declared to ... */
                                warning(215, sym->s_name);



Home | Main Index | Thread Index | Old Index