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: remove message 66 about missing se...



details:   https://anonhg.NetBSD.org/src/rev/193a23acbeca
branches:  trunk
changeset: 984666:193a23acbeca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 15 20:05:49 2021 +0000

description:
lint: remove message 66 about missing semicolon in struct-declaration

diffstat:

 tests/usr.bin/xlint/lint1/decl_struct_c90.c      |  11 +++++---
 tests/usr.bin/xlint/lint1/decl_struct_c90.exp    |   3 +-
 tests/usr.bin/xlint/lint1/decl_struct_member.c   |   4 +-
 tests/usr.bin/xlint/lint1/decl_struct_member.exp |   1 -
 tests/usr.bin/xlint/lint1/msg_066.c              |  11 ++++++-
 tests/usr.bin/xlint/lint1/msg_066.exp            |   3 +-
 usr.bin/xlint/lint1/cgram.y                      |  31 ++++++++---------------
 usr.bin/xlint/lint1/err.c                        |   6 ++--
 8 files changed, 36 insertions(+), 34 deletions(-)

diffs (201 lines):

diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/decl_struct_c90.c
--- a/tests/usr.bin/xlint/lint1/decl_struct_c90.c       Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_c90.c       Thu Jul 15 20:05:49 2021 +0000
@@ -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] */
diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/decl_struct_c90.exp
--- a/tests/usr.bin/xlint/lint1/decl_struct_c90.exp     Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_c90.exp     Thu Jul 15 20:05:49 2021 +0000
@@ -1,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]
diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/decl_struct_member.c
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.c    Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.c    Thu Jul 15 20:05:49 2021 +0000
@@ -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 {
        char a(_)0              /* expect: syntax error '0' */
-}                              /* expect: ';' after last */
+}
 /*
  * FIXME: adding a semicolon here triggers another assertion:
  *
diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/decl_struct_member.exp
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.exp  Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.exp  Thu Jul 15 20:05:49 2021 +0000
@@ -4,5 +4,4 @@
 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]
diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/msg_066.c
--- a/tests/usr.bin/xlint/lint1/msg_066.c       Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_066.c       Thu Jul 15 20:05:49 2021 +0000
@@ -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] */
diff -r e6dfa9482dcc -r 193a23acbeca tests/usr.bin/xlint/lint1/msg_066.exp
--- a/tests/usr.bin/xlint/lint1/msg_066.exp     Thu Jul 15 19:51:29 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_066.exp     Thu Jul 15 20:05:49 2021 +0000
@@ -1,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]
diff -r e6dfa9482dcc -r 193a23acbeca usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu Jul 15 19:51:29 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu Jul 15 20:05:49 2021 +0000
@@ -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_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 @@
          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 @@
                        $$ = NULL;
                }
          }
-       | error {
+       | error T_SEMI {
                symtyp = FVFT;
                $$ = NULL;
          }
diff -r e6dfa9482dcc -r 193a23acbeca usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Thu Jul 15 19:51:29 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Thu Jul 15 20:05:49 2021 +0000
@@ -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 @@
        "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 */



Home | Main Index | Thread Index | Old Index