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 for typespec ...
details: https://anonhg.NetBSD.org/src/rev/39f82c7717c5
branches: trunk
changeset: 984518:39f82c7717c5
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 10 18:56:54 2021 +0000
description:
lint: merge duplicate code for typespec and notype_typespec
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 48 ++++++++++++++++++++------------------------
1 files changed, 22 insertions(+), 26 deletions(-)
diffs (98 lines):
diff -r 8f26a1443d6e -r 39f82c7717c5 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Sat Jul 10 18:42:28 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Sat Jul 10 18:56:54 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.298 2021/07/10 18:13:06 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.299 2021/07/10 18:56:54 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.298 2021/07/10 18:13:06 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.299 2021/07/10 18:56:54 rillig Exp $");
#endif
#include <limits.h>
@@ -535,17 +535,11 @@
;
declaration_specifiers: /* C99 6.7 */
- typespec {
- add_type($1);
- }
- | declmods typespec {
- add_type($2);
- }
+ add_typespec
+ | declmods add_typespec
| type_attribute declaration_specifiers
| declaration_specifiers declmod
- | declaration_specifiers notype_typespec {
- add_type($2);
- }
+ | declaration_specifiers add_notype_typespec
;
declmods:
@@ -559,14 +553,18 @@
;
qualifier_or_storage_class:
- T_QUAL {
- add_qualifier($1);
- }
+ add_type_qualifier
| T_SCLASS {
add_storage_class($1);
}
;
+add_typespec:
+ typespec {
+ add_type($1);
+ }
+ ;
+
typespec:
notype_typespec
| T_TYPENAME {
@@ -574,6 +572,12 @@
}
;
+add_notype_typespec:
+ notype_typespec {
+ add_type($1);
+ }
+ ;
+
notype_typespec:
T_TYPE {
$$ = gettyp($1);
@@ -711,18 +715,10 @@
;
noclass_declspecs_postfix:
- typespec {
- add_type($1);
- }
- | add_type_qualifier_list typespec {
- add_type($2);
- }
- | noclass_declspecs_postfix T_QUAL {
- add_qualifier($2);
- }
- | noclass_declspecs_postfix notype_typespec {
- add_type($2);
- }
+ add_typespec
+ | add_type_qualifier_list add_typespec
+ | noclass_declspecs_postfix add_type_qualifier
+ | noclass_declspecs_postfix add_notype_typespec
| noclass_declspecs_postfix type_attribute
;
Home |
Main Index |
Thread Index |
Old Index