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: rename clrtyp/deftyp to begin_type...
details: https://anonhg.NetBSD.org/src/rev/bf6db2a47a1b
branches: trunk
changeset: 984512:bf6db2a47a1b
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 10 17:35:54 2021 +0000
description:
lint: rename clrtyp/deftyp to begin_type/end_type
The abbreviations clr/def did not make it obvious that these two
functions or grammar rules form pairs.
No functional change.
diffstat:
tests/usr.bin/xlint/lint1/decl_struct_member.c | 4 +-
tests/usr.bin/xlint/lint1/msg_247.c | 4 +-
tests/usr.bin/xlint/lint1/msg_249.c | 4 +-
usr.bin/xlint/lint1/cgram.y | 70 +++++++++++++-------------
usr.bin/xlint/lint1/decl.c | 28 +++++-----
usr.bin/xlint/lint1/externs1.h | 6 +-
usr.bin/xlint/lint1/lint1.h | 4 +-
7 files changed, 60 insertions(+), 60 deletions(-)
diffs (truncated from 429 to 300 lines):
diff -r e80a82e33a15 -r bf6db2a47a1b tests/usr.bin/xlint/lint1/decl_struct_member.c
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.c Sat Jul 10 17:33:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.c Sat Jul 10 17:35:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl_struct_member.c,v 1.2 2021/06/20 11:24:32 rillig Exp $ */
+/* $NetBSD: decl_struct_member.c,v 1.3 2021/07/10 17:35:54 rillig Exp $ */
# 3 "decl_struct_member.c"
/*
@@ -20,6 +20,6 @@
/*
* FIXME: adding a semicolon here triggers another assertion:
*
- * assertion "t == NOTSPEC" failed in deftyp at decl.c:774
+ * assertion "t == NOTSPEC" failed in end_type at decl.c:774
*/
/* expect+1: cannot recover from previous errors */
diff -r e80a82e33a15 -r bf6db2a47a1b tests/usr.bin/xlint/lint1/msg_247.c
--- a/tests/usr.bin/xlint/lint1/msg_247.c Sat Jul 10 17:33:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_247.c Sat Jul 10 17:35:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_247.c,v 1.13 2021/04/09 20:00:07 rillig Exp $ */
+/* $NetBSD: msg_247.c,v 1.14 2021/07/10 17:35:54 rillig Exp $ */
# 3 "msg_247.c"
// Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -23,7 +23,7 @@
* XXX: The target type is reported as 'struct <unnamed>'. In cases
* like these, it would be helpful to print at least the type name
* of the pointer. This type name though is discarded immediately
- * when the parser reduces 'T_TYPENAME clrtyp' to 'clrtyp_typespec'.
+ * in the grammar rule 'typespec: T_TYPENAME'.
* After that, the target type of the cast is just an unnamed struct,
* with no hint at all that there is a typedef for a pointer to the
* struct.
diff -r e80a82e33a15 -r bf6db2a47a1b tests/usr.bin/xlint/lint1/msg_249.c
--- a/tests/usr.bin/xlint/lint1/msg_249.c Sat Jul 10 17:33:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_249.c Sat Jul 10 17:35:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_249.c,v 1.7 2021/07/10 11:22:19 rillig Exp $ */
+/* $NetBSD: msg_249.c,v 1.8 2021/07/10 17:35:54 rillig Exp $ */
# 3 "msg_249.c"
// Test for message: syntax error '%s' [249]
@@ -53,7 +53,7 @@
/* cover 'noclass_declspecs ...' */
const int noclass_declspecs;
- /* cover 'noclass_declmods deftyp ...' */
+ /* cover 'add_type_qualifier_list end_type' */
/* expect+1: error: syntax error 'member without type' [249] */
const;
};
diff -r e80a82e33a15 -r bf6db2a47a1b usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Sat Jul 10 17:33:28 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Sat Jul 10 17:35:54 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.295 2021/07/10 17:17:05 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.296 2021/07/10 17:35: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.295 2021/07/10 17:17:05 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.296 2021/07/10 17:35:54 rillig Exp $");
#endif
#include <limits.h>
@@ -393,7 +393,7 @@
warning(0);
}
}
- | clrtyp deftyp notype_init_decls T_SEMI {
+ | begin_type end_type notype_init_decls T_SEMI {
if (sflag) {
/* old style declaration; add 'int' */
error(1);
@@ -441,13 +441,13 @@
;
func_decl:
- clrtyp deftyp notype_decl {
+ begin_type end_type notype_decl {
$$ = $3;
}
- | clrtyp declmods deftyp notype_decl {
+ | begin_type declmods end_type notype_decl {
$$ = $4;
}
- | clrtyp declaration_specifiers deftyp type_decl {
+ | begin_type declaration_specifiers end_type type_decl {
$$ = $4;
}
;
@@ -469,12 +469,12 @@
* needs other error handling.
*/
arg_declaration:
- clrtyp declmods deftyp T_SEMI {
+ begin_type declmods end_type T_SEMI {
/* empty declaration */
warning(2);
}
- | clrtyp declmods deftyp notype_init_decls T_SEMI
- | clrtyp declaration_specifiers deftyp T_SEMI {
+ | begin_type declmods end_type notype_init_decls T_SEMI
+ | begin_type declaration_specifiers end_type T_SEMI {
if (!dcs->d_nonempty_decl) {
/* empty declaration */
warning(2);
@@ -483,14 +483,14 @@
warning(3, type_name(dcs->d_type));
}
}
- | clrtyp declaration_specifiers deftyp type_init_decls T_SEMI {
+ | begin_type declaration_specifiers end_type type_init_decls T_SEMI {
if (dcs->d_nonempty_decl) {
/* '%s' declared in argument declaration list */
warning(3, type_name(dcs->d_type));
}
}
- | clrtyp declmods error
- | clrtyp declaration_specifiers error
+ | begin_type declmods error
+ | begin_type declaration_specifiers error
;
declaration: /* C99 6.7 */
@@ -499,7 +499,7 @@
;
declaration_noerror: /* see C99 6.7 'declaration' */
- clrtyp declmods deftyp T_SEMI {
+ begin_type declmods end_type T_SEMI {
if (dcs->d_scl == TYPEDEF) {
/* typedef declares no type name */
warning(72);
@@ -508,8 +508,8 @@
warning(2);
}
}
- | clrtyp declmods deftyp notype_init_decls T_SEMI
- | clrtyp declaration_specifiers deftyp T_SEMI {
+ | begin_type declmods end_type notype_init_decls T_SEMI
+ | begin_type declaration_specifiers end_type T_SEMI {
if (dcs->d_scl == TYPEDEF) {
/* typedef declares no type name */
warning(72);
@@ -518,18 +518,18 @@
warning(2);
}
}
- | clrtyp declaration_specifiers deftyp type_init_decls T_SEMI
+ | begin_type declaration_specifiers end_type type_init_decls T_SEMI
;
-clrtyp:
+begin_type:
/* empty */ {
- clrtyp();
+ begin_type();
}
;
-deftyp:
+end_type:
/* empty */ {
- deftyp();
+ end_type();
}
;
@@ -665,25 +665,25 @@
;
member_declaration:
- clrtyp add_type_qualifier_list deftyp {
+ begin_type add_type_qualifier_list end_type {
/* too late, i know, but getsym() compensates it */
symtyp = FMEMBER;
} notype_member_decls type_attribute_opt {
symtyp = FVFT;
$$ = $5;
}
- | clrtyp noclass_declspecs deftyp {
+ | begin_type noclass_declspecs end_type {
symtyp = FMEMBER;
} type_member_decls type_attribute_opt {
symtyp = FVFT;
$$ = $5;
}
- | clrtyp add_type_qualifier_list deftyp type_attribute_opt {
+ | begin_type add_type_qualifier_list end_type type_attribute_opt {
/* syntax error '%s' */
error(249, "member without type");
$$ = NULL;
}
- | clrtyp noclass_declspecs deftyp type_attribute_opt {
+ | begin_type noclass_declspecs end_type type_attribute_opt {
symtyp = FVFT;
if (!Sflag)
/* anonymous struct/union members is a C9X feature */
@@ -1150,22 +1150,22 @@
/* XXX: C99 6.7.5 defines the same name, but it looks completely different. */
parameter_declaration:
- clrtyp declmods deftyp {
+ begin_type declmods end_type {
$$ = declare_argument(abstract_name(), false);
}
- | clrtyp declaration_specifiers deftyp {
+ | begin_type declaration_specifiers end_type {
$$ = declare_argument(abstract_name(), false);
}
- | clrtyp declmods deftyp notype_param_decl {
+ | begin_type declmods end_type notype_param_decl {
$$ = declare_argument($4, false);
}
- | clrtyp declaration_specifiers deftyp type_param_decl {
+ | begin_type declaration_specifiers end_type type_param_decl {
$$ = declare_argument($4, false);
}
- | clrtyp declmods deftyp abstract_declarator {
+ | begin_type declmods end_type abstract_declarator {
$$ = declare_argument($4, false);
}
- | clrtyp declaration_specifiers deftyp abstract_declarator {
+ | begin_type declaration_specifiers end_type abstract_declarator {
$$ = declare_argument($4, false);
}
;
@@ -1268,16 +1268,16 @@
;
abstract_declaration:
- clrtyp add_type_qualifier_list deftyp {
+ begin_type add_type_qualifier_list end_type {
$$ = declare_1_abstract(abstract_name());
}
- | clrtyp noclass_declspecs deftyp {
+ | begin_type noclass_declspecs end_type {
$$ = declare_1_abstract(abstract_name());
}
- | clrtyp add_type_qualifier_list deftyp abstract_declarator {
+ | begin_type add_type_qualifier_list end_type abstract_declarator {
$$ = declare_1_abstract($4);
}
- | clrtyp noclass_declspecs deftyp abstract_declarator {
+ | begin_type noclass_declspecs end_type abstract_declarator {
$$ = declare_1_abstract($4);
}
;
@@ -1540,7 +1540,7 @@
for_exprs: /* see C99 6.8.5 */
for_start
- clrtyp declaration_specifiers deftyp notype_init_decls T_SEMI
+ begin_type declaration_specifiers end_type notype_init_decls T_SEMI
expr_opt T_SEMI
expr_opt T_RPAREN {
/* variable declaration in for loop */
diff -r e80a82e33a15 -r bf6db2a47a1b usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sat Jul 10 17:33:28 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sat Jul 10 17:35:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.196 2021/07/10 12:10:39 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.197 2021/07/10 17:35:54 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.196 2021/07/10 12:10:39 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.197 2021/07/10 17:35:54 rillig Exp $");
#endif
#include <sys/param.h>
@@ -235,7 +235,7 @@
} else {
/*
* multiple storage classes. An error will be reported in
- * deftyp().
+ * end_type().
*/
dcs->d_mscl = true;
}
@@ -244,7 +244,7 @@
/*
* Remember the type, modifier or typedef name returned by the parser
* in *dcs (top element of decl stack). This information is used in
- * deftyp() to build the type used for all declarators in this
+ * end_type() to build the type used for all declarators in this
* declaration.
*
Home |
Main Index |
Thread Index |
Old Index