Module Name: src
Committed By: rillig
Date: Thu Jul 15 20:05:49 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: decl_struct_c90.c decl_struct_c90.exp
decl_struct_member.c decl_struct_member.exp msg_066.c msg_066.exp
src/usr.bin/xlint/lint1: cgram.y err.c
Log Message:
lint: remove message 66 about missing semicolon in struct-declaration
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_066.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_066.exp
cvs rdiff -u -r1.327 -r1.328 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/xlint/lint1/err.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/decl_struct_c90.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.2
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.1 Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.c Thu Jul 15 20:05:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl_struct_c90.c,v 1.1 2021/07/15 19:51:29 rillig Exp $ */
+/* $NetBSD: decl_struct_c90.c,v 1.2 2021/07/15 20:05:49 rillig Exp $ */
# 3 "decl_struct_c90.c"
/*
@@ -9,10 +9,13 @@
/*
* All of K&R, C90, C99 require that a struct member declaration is
- * terminated with a semicolon. No idea why lint allows the missing
- * semicolon in non-C90 mode.
+ * terminated with a semicolon.
+ *
+ * Before cgram.y 1.328 from 2021-07-15, lint allowed the missing semicolon
+ * in non-C90 mode, no idea why.
*/
struct missing_semicolon {
int member
};
-/* expect-1: error: syntax requires ';' after last struct/union member [66] */
+/* expect-1: error: syntax error '}' [249] */
+/* expect+1: error: cannot recover from previous errors [224] */
Index: src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.2
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.1 Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp Thu Jul 15 20:05:49 2021
@@ -1 +1,2 @@
-decl_struct_c90.c(17): error: syntax requires ';' after last struct/union member [66]
+decl_struct_c90.c(19): error: syntax error '}' [249]
+decl_struct_c90.c(22): error: cannot recover from previous errors [224]
Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.8
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.7 Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c Thu Jul 15 20:05:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl_struct_member.c,v 1.7 2021/07/15 19:51:29 rillig Exp $ */
+/* $NetBSD: decl_struct_member.c,v 1.8 2021/07/15 20:05:49 rillig Exp $ */
# 3 "decl_struct_member.c"
struct multi_attributes {
@@ -52,7 +52,7 @@ struct {
*/
struct {
char a(_)0 /* expect: syntax error '0' */
-} /* expect: ';' after last */
+}
/*
* FIXME: adding a semicolon here triggers another assertion:
*
Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.7
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.6 Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.exp Thu Jul 15 20:05:49 2021
@@ -4,5 +4,4 @@ decl_struct_member.c(38): error: syntax
decl_struct_member.c(38): warning: empty declaration [0]
decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
decl_struct_member.c(54): error: syntax error '0' [249]
-decl_struct_member.c(55): warning: syntax requires ';' after last struct/union member [66]
decl_struct_member.c(62): error: cannot recover from previous errors [224]
Index: src/tests/usr.bin/xlint/lint1/msg_066.c
diff -u src/tests/usr.bin/xlint/lint1/msg_066.c:1.3 src/tests/usr.bin/xlint/lint1/msg_066.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_066.c:1.3 Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_066.c Thu Jul 15 20:05:49 2021
@@ -1,8 +1,15 @@
-/* $NetBSD: msg_066.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */
+/* $NetBSD: msg_066.c,v 1.4 2021/07/15 20:05:49 rillig Exp $ */
# 3 "msg_066.c"
// Test for message: syntax requires ';' after last struct/union member [66]
+/*
+ * This message was removed in cgram.y 1.328 from 2021-07-15 because all
+ * C standards and even K&R require a semicolon.
+ */
+
struct number {
int value
-}; /* expect: 66 */
+};
+/* expect-1: syntax error '}' [249] */
+/* expect+1: error: cannot recover from previous errors [224] */
Index: src/tests/usr.bin/xlint/lint1/msg_066.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_066.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_066.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_066.exp:1.2 Fri Jan 8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_066.exp Thu Jul 15 20:05:49 2021
@@ -1 +1,2 @@
-msg_066.c(8): warning: syntax requires ';' after last struct/union member [66]
+msg_066.c(13): error: syntax error '}' [249]
+msg_066.c(16): error: cannot recover from previous errors [224]
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.327 src/usr.bin/xlint/lint1/cgram.y:1.328
--- src/usr.bin/xlint/lint1/cgram.y:1.327 Thu Jul 15 18:18:15 2021
+++ src/usr.bin/xlint/lint1/cgram.y Thu Jul 15 20:05:49 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.328 2021/07/15 20:05:49 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.328 2021/07/15 20:05:49 rillig Exp $");
#endif
#include <limits.h>
@@ -933,26 +933,17 @@ struct_declaration_lbrace: /* see C99 6.
;
struct_declaration_list_with_rbrace: /* see C99 6.7.2.1 */
- struct_declaration_list T_SEMI T_RBRACE
- | struct_declaration_list T_RBRACE {
- if (sflag) {
- /* syntax req. ';' after last struct/union member */
- error(66);
- } else {
- /* syntax req. ';' after last struct/union member */
- warning(66);
- }
- $$ = $1;
- }
+ struct_declaration_list T_RBRACE
| T_RBRACE {
+ /* XXX: This is not allowed by any C standard. */
$$ = NULL;
}
;
struct_declaration_list: /* C99 6.7.2.1 */
struct_declaration
- | struct_declaration_list T_SEMI struct_declaration {
- $$ = lnklst($1, $3);
+ | struct_declaration_list struct_declaration {
+ $$ = lnklst($1, $2);
}
;
@@ -960,22 +951,22 @@ struct_declaration: /* C99 6.7.2.1 */
begin_type_noclass_declmods end_type {
/* too late, i know, but getsym() compensates it */
symtyp = FMEMBER;
- } notype_struct_declarators type_attribute_opt {
+ } notype_struct_declarators type_attribute_opt T_SEMI {
symtyp = FVFT;
$$ = $4;
}
| begin_type_noclass_declspecs end_type {
symtyp = FMEMBER;
- } type_struct_declarators type_attribute_opt {
+ } type_struct_declarators type_attribute_opt T_SEMI {
symtyp = FVFT;
$$ = $4;
}
- | begin_type_noclass_declmods end_type type_attribute_opt {
+ | begin_type_noclass_declmods end_type type_attribute_opt T_SEMI {
/* syntax error '%s' */
error(249, "member without type");
$$ = NULL;
}
- | begin_type_noclass_declspecs end_type type_attribute_opt {
+ | begin_type_noclass_declspecs end_type type_attribute_opt T_SEMI {
symtyp = FVFT;
if (!Sflag)
/* anonymous struct/union members is a C9X feature */
@@ -990,7 +981,7 @@ struct_declaration: /* C99 6.7.2.1 */
$$ = NULL;
}
}
- | error {
+ | error T_SEMI {
symtyp = FVFT;
$$ = NULL;
}
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.129 src/usr.bin/xlint/lint1/err.c:1.130
--- src/usr.bin/xlint/lint1/err.c:1.129 Tue Jul 13 22:01:34 2021
+++ src/usr.bin/xlint/lint1/err.c Thu Jul 15 20:05:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.129 2021/07/13 22:01:34 rillig Exp $ */
+/* $NetBSD: err.c,v 1.130 2021/07/15 20:05:49 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.129 2021/07/13 22:01:34 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.130 2021/07/15 20:05:49 rillig Exp $");
#endif
#include <sys/types.h>
@@ -120,7 +120,7 @@ const char *const msgs[] = {
"prototype does not match old-style definition", /* 63 */
"()-less function definition", /* 64 */
"%s has no named members", /* 65 */
- "syntax requires ';' after last struct/union member", /* 66 */
+ "", /* 66 */
"cannot return incomplete type", /* 67 */
"typedef already qualified with '%s'", /* 68 */
"inappropriate qualifiers with 'void'", /* 69 */