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: merge duplicate code in declarations



details:   https://anonhg.NetBSD.org/src/rev/a7d87239d566
branches:  trunk
changeset: 1022392:a7d87239d566
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 15 18:18:15 2021 +0000

description:
lint: merge duplicate code in declarations

No functional change, code coverage outside cgram.y stays the same.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  26 +++-----------------------
 1 files changed, 3 insertions(+), 23 deletions(-)

diffs (48 lines):

diff -r 627d92c2ae92 -r a7d87239d566 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu Jul 15 18:13:25 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu Jul 15 18:18:15 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.326 2021/07/15 18:13:25 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 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.326 2021/07/15 18:13:25 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1912,27 +1912,7 @@
                        warning(1);
                }
          }
-       | begin_type_declmods end_type T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | begin_type_declmods end_type notype_init_declarators T_SEMI
-       | begin_type_declaration_specifiers end_type T_SEMI {
-               if (dcs->d_scl == TYPEDEF) {
-                       /* typedef declares no type name */
-                       warning(72);
-               } else if (!dcs->d_nonempty_decl) {
-                       /* empty declaration */
-                       warning(2);
-               }
-         }
-       | begin_type_declaration_specifiers end_type
-           type_init_declarators T_SEMI
+       | declaration
        | error T_SEMI {
                global_clean_up();
          }



Home | Main Index | Thread Index | Old Index