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 dcs manipulation functions ...



details:   https://anonhg.NetBSD.org/src/rev/8be023513d07
branches:  trunk
changeset: 369693:8be023513d07
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 28 08:41:06 2022 +0000

description:
lint: rename dcs manipulation functions to be clearer

No functional change.

diffstat:

 tests/usr.bin/xlint/lint1/decl.c    |   4 +-
 tests/usr.bin/xlint/lint1/queries.c |   4 +-
 usr.bin/xlint/lint1/cgram.y         |  44 +++++++++++++++++-----------------
 usr.bin/xlint/lint1/decl.c          |  46 ++++++++++++++++++------------------
 usr.bin/xlint/lint1/externs1.h      |  18 +++++++-------
 usr.bin/xlint/lint1/lint1.h         |   6 ++--
 6 files changed, 61 insertions(+), 61 deletions(-)

diffs (truncated from 411 to 300 lines):

diff -r 8e82ffbfcb51 -r 8be023513d07 tests/usr.bin/xlint/lint1/decl.c
--- a/tests/usr.bin/xlint/lint1/decl.c  Sun Aug 28 08:40:56 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/decl.c  Sun Aug 28 08:41:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: decl.c,v 1.18 2022/06/22 19:23:18 rillig Exp $ */
+/*     $NetBSD: decl.c,v 1.19 2022/08/28 08:41:06 rillig Exp $ */
 # 3 "decl.c"
 
 /*
@@ -144,7 +144,7 @@
 
 /*
  * Before decl.c 1.201 from 2021-07-15, lint crashed with an internal error
- * in end_type.
+ * in dcs_end_type (named end_type back then).
  */
 unsigned long sizes =
     sizeof(const typeof(bool)) +
diff -r 8e82ffbfcb51 -r 8be023513d07 tests/usr.bin/xlint/lint1/queries.c
--- a/tests/usr.bin/xlint/lint1/queries.c       Sun Aug 28 08:40:56 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/queries.c       Sun Aug 28 08:41:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: queries.c,v 1.3 2022/07/08 21:19:07 rillig Exp $       */
+/*     $NetBSD: queries.c,v 1.4 2022/08/28 08:41:06 rillig Exp $       */
 # 3 "queries.c"
 
 /*
@@ -173,7 +173,7 @@
        /*
         * Neither GCC nor Clang accept typeof(bit-field), as that would add
         * unnecessary complexity.  Lint accepts it but silently discards the
-        * bit-field portion from the type; see add_type.
+        * bit-field portion from the type; see dcs_add_type.
         */
        /* expect+1: redundant cast from 'unsigned char' to 'unsigned int' before assignment [Q7] */
        bits.u9 = (typeof(bits.u9))u8;
diff -r 8e82ffbfcb51 -r 8be023513d07 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Aug 28 08:40:56 2022 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Aug 28 08:41:06 2022 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.421 2022/08/25 19:03:47 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.422 2022/08/28 08:41:06 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.421 2022/08/25 19:03:47 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.422 2022/08/28 08:41:06 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -730,24 +730,24 @@
 
 begin_type_declaration_specifiers:     /* see C99 6.7 */
          begin_type_typespec {
-               add_type($1);
+               dcs_add_type($1);
          }
        | begin_type_declmods type_specifier {
-               add_type($2);
+               dcs_add_type($2);
          }
        | type_attribute begin_type_declaration_specifiers
        | begin_type_declaration_specifiers declmod
        | begin_type_declaration_specifiers notype_type_specifier {
-               add_type($2);
+               dcs_add_type($2);
          }
        ;
 
 begin_type_declmods:           /* see C99 6.7 */
          begin_type T_QUAL {
-               add_qualifier($2);
+               dcs_add_qualifier($2);
          }
        | begin_type T_SCLASS {
-               add_storage_class($2);
+               dcs_add_storage_class($2);
          }
        | begin_type_declmods declmod
        ;
@@ -759,16 +759,16 @@
 
 begin_type_specifier_qualifier_list_postfix:
          begin_type_typespec {
-               add_type($1);
+               dcs_add_type($1);
          }
        | begin_type_qualifier_list type_specifier {
-               add_type($2);
+               dcs_add_type($2);
          }
        | begin_type_specifier_qualifier_list_postfix T_QUAL {
-               add_qualifier($2);
+               dcs_add_qualifier($2);
          }
        | begin_type_specifier_qualifier_list_postfix notype_type_specifier {
-               add_type($2);
+               dcs_add_type($2);
          }
        | begin_type_specifier_qualifier_list_postfix type_attribute
        ;
@@ -784,19 +784,19 @@
 
 begin_type_qualifier_list:
          begin_type T_QUAL {
-               add_qualifier($2);
+               dcs_add_qualifier($2);
          }
        | begin_type_qualifier_list T_QUAL {
-               add_qualifier($2);
+               dcs_add_qualifier($2);
          }
        ;
 
 declmod:
          T_QUAL {
-               add_qualifier($1);
+               dcs_add_qualifier($1);
          }
        | T_SCLASS {
-               add_storage_class($1);
+               dcs_add_storage_class($1);
          }
        | type_attribute_list
        ;
@@ -821,20 +821,20 @@
        | T_ALIGNAS T_LPAREN type_specifier T_RPAREN    /* C11 6.7.5 */
        | T_ALIGNAS T_LPAREN constant_expr T_RPAREN     /* C11 6.7.5 */
        | T_PACKED {
-               addpacked();
+               dcs_add_packed();
          }
        | T_NORETURN
        ;
 
 begin_type:
          /* empty */ {
-               begin_type();
+               dcs_begin_type();
          }
        ;
 
 end_type:
          /* empty */ {
-               end_type();
+               dcs_end_type();
          }
        ;
 
@@ -1852,10 +1852,10 @@
 
 asm_statement:                 /* GCC extension */
          T_ASM T_LPAREN read_until_rparen T_SEMI {
-               setasm();
+               dcs_set_asm();
          }
        | T_ASM T_QUAL T_LPAREN read_until_rparen T_SEMI {
-               setasm();
+               dcs_set_asm();
          }
        | T_ASM error
        ;
@@ -2045,10 +2045,10 @@
        | T_NAME {
                const char *name = $1->sb_name;
                if (is_either(name, "packed", "__packed__"))
-                       addpacked();
+                       dcs_add_packed();
                else if (is_either(name, "used", "__used__") ||
                    is_either(name, "unused", "__unused__"))
-                       add_attr_used();
+                       dcs_set_used();
                else if (is_either(name, "fallthrough",
                    "__fallthrough__"))
                        fallthru(1);
diff -r 8e82ffbfcb51 -r 8be023513d07 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Aug 28 08:40:56 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Aug 28 08:41:06 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.295 2022/08/26 19:44:19 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.296 2022/08/28 08:41:06 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.295 2022/08/26 19:44:19 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.296 2022/08/28 08:41:06 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -64,7 +64,7 @@
 
 static type_t  *tdeferr(type_t *, tspec_t);
 static void    settdsym(type_t *, sym_t *);
-static void    align(unsigned int, unsigned int);
+static void    dcs_align(unsigned int, unsigned int);
 static sym_t   *newtag(sym_t *, scl_t, bool, bool);
 static bool    eqargs(const type_t *, const type_t *, bool *);
 static bool    mnoarg(const type_t *, bool *);
@@ -224,7 +224,7 @@
  * storage classes.
  */
 void
-add_storage_class(scl_t sc)
+dcs_add_storage_class(scl_t sc)
 {
 
        if (sc == INLINE) {
@@ -249,7 +249,7 @@
 /*
  * Remember the type, modifier or typedef name returned by the parser
  * in *dcs (top element of decl stack). This information is used in
- * end_type() to build the type used for all declarators in this
+ * dcs_end_type to build the type used for all declarators in this
  * declaration.
  *
  * If tp->t_typedef is 1, the type comes from a previously defined typename.
@@ -257,7 +257,7 @@
  * struct/union/enum tag.
  */
 void
-add_type(type_t *tp)
+dcs_add_type(type_t *tp)
 {
        tspec_t t;
 
@@ -519,7 +519,7 @@
 }
 
 void
-addpacked(void)
+dcs_add_packed(void)
 {
        if (dcs->d_type == NULL)
                dcs->d_packed = true;
@@ -528,21 +528,21 @@
 }
 
 void
-add_attr_used(void)
+dcs_set_used(void)
 {
        dcs->d_used = true;
 }
 
 /*
  * Remember a qualifier which is part of the declaration specifiers
- * (and not the declarator) in the top element of the declaration stack.
+ * (and not the declarator).
  * Also detect multiple qualifiers of the same kind.
 
- * The remembered qualifier is used by end_type() to construct the type
+ * The remembered qualifier is used by dcs_end_type to construct the type
  * for all declarators.
  */
 void
-add_qualifier(tqual_t q)
+dcs_add_qualifier(tqual_t q)
 {
 
        if (q == CONST) {
@@ -661,13 +661,13 @@
  * There is no need to clear d_asm in dinfo structs with context AUTO,
  * because these structs are freed at the end of the compound statement.
  * But it must be cleared in the outermost dinfo struct, which has
- * context EXTERN. This could be done in begin_type() and would work for C90,
- * but not for C99 or C++ (due to mixed statements and declarations). Thus
- * we clear it in global_clean_up_decl(), which is used to do some cleanup
- * after global declarations/definitions.
+ * context EXTERN. This could be done in dcs_begin_type and would work for
+ * C90, but not for C99 or C++ (due to mixed statements and declarations).
+ * Thus we clear it in global_clean_up_decl(), which is used to do some
+ * cleanup after global declarations/definitions.
  */
 void
-setasm(void)
+dcs_set_asm(void)
 {
        dinfo_t *di;
 
@@ -680,7 +680,7 @@
  * will be used by the next declaration
  */
 void
-begin_type(void)
+dcs_begin_type(void)
 {
 
        dcs->d_abstract_type = NOTSPEC;
@@ -793,7 +793,7 @@
  * context.
  */



Home | Main Index | Thread Index | Old Index