Module Name: src Committed By: rillig Date: Sun Aug 29 17:01:27 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.exp msg_215.c msg_215.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: in C99 mode, make implicit function declarations an error In tree.c 1.294 from 2021-06-28, I had already tried this, but at that time, there were too many implicit function definitions in the NetBSD tree. Most of them were GCC builtins, which lint did not recognize. Therefore I had to revert to a warning in tree.c 1.302 from 2021-06-30. In the meantime, lint has learnt to recognize compiler builtins, see is_compiler_builtin, so try again now. The build logs from x86_64, i386, sparc and sparc64 show no more implicit function declarations. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_155.exp \ src/tests/usr.bin/xlint/lint1/msg_215.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_215.exp cvs rdiff -u -r1.362 -r1.363 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_155.exp diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.10 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.11 --- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.10 Wed Jun 30 14:32:41 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.exp Sun Aug 29 17:01:27 2021 @@ -3,7 +3,7 @@ msg_155.c(28): warning: passing 'struct 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): warning: function 'c99_6_7_6_example_f' implicitly declared to return int [215] +msg_155.c(42): error: 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] Index: src/tests/usr.bin/xlint/lint1/msg_215.c diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.10 src/tests/usr.bin/xlint/lint1/msg_215.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_215.c:1.10 Sun Aug 29 15:49:04 2021 +++ src/tests/usr.bin/xlint/lint1/msg_215.c Sun Aug 29 17:01:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_215.c,v 1.10 2021/08/29 15:49:04 rillig Exp $ */ +/* $NetBSD: msg_215.c,v 1.11 2021/08/29 17:01:27 rillig Exp $ */ # 3 "msg_215.c" // Test for message: function '%s' implicitly declared to return int [215] @@ -17,7 +17,7 @@ struct str { void test(struct str str, const double *p_double) { - /* expect+1: warning: function 'name' implicitly declared to return int [215] */ + /* expect+1: error: function 'name' implicitly declared to return int [215] */ name(); /* expect+2: error: 'parenthesized' undefined [99] */ Index: src/tests/usr.bin/xlint/lint1/msg_215.exp diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.9 --- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.8 Wed Jun 30 14:32:41 2021 +++ src/tests/usr.bin/xlint/lint1/msg_215.exp Sun Aug 29 17:01:27 2021 @@ -1,4 +1,4 @@ -msg_215.c(21): warning: function 'name' implicitly declared to return int [215] +msg_215.c(21): error: 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] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.362 src/usr.bin/xlint/lint1/tree.c:1.363 --- src/usr.bin/xlint/lint1/tree.c:1.362 Sun Aug 29 16:17:08 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Aug 29 17:01:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.362 2021/08/29 16:17:08 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.363 2021/08/29 17:01:27 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.362 2021/08/29 16:17:08 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.363 2021/08/29 17:01:27 rillig Exp $"); #endif #include <float.h> @@ -236,7 +236,7 @@ build_name(sym_t *sym, int follow_token) */ } else if (Sflag) { /* function '%s' implicitly declared to ... */ - warning(215, sym->s_name); + error(215, sym->s_name); } else if (sflag) { /* function '%s' implicitly declared to ... */ warning(215, sym->s_name);