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 Improve restrict handling.



details:   https://anonhg.NetBSD.org/src/rev/2fed06f36c84
branches:  trunk
changeset: 1027658:2fed06f36c84
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 14 20:13:13 2021 +0000

description:
Improve restrict handling.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  12 +++++++++---
 usr.bin/xlint/lint1/lex.c   |   6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r ad9efd3bb750 -r 2fed06f36c84 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Dec 14 20:12:48 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Dec 14 20:13:13 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.372 2021/11/28 09:59:59 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.373 2021/12/14 20:13:13 christos 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.372 2021/11/28 09:59:59 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.373 2021/12/14 20:13:13 christos Exp $");
 #endif
 
 #include <limits.h>
@@ -1357,7 +1357,7 @@
          }
        | array_size {
                $$.has_dim = true;
-               $$.dim = to_int_constant($1, false);
+               $$.dim = $1 == NULL ? 0 : to_int_constant($1, false);
          }
        ;
 
@@ -1370,6 +1370,12 @@
                c11ism(343);
                $$ = $3;
          }
+       | T_QUAL {
+               /* C11, 6.7.6.2 */
+               if ($1 != RESTRICT)
+                       yyerror("Bad attribute");
+               $$ = NULL;
+       }
        | constant_expr
        ;
 
diff -r ad9efd3bb750 -r 2fed06f36c84 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Tue Dec 14 20:12:48 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Tue Dec 14 20:13:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.88 2021/11/27 20:13:48 christos Exp $ */
+/* $NetBSD: lex.c,v 1.89 2021/12/14 20:13:13 christos 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: lex.c,v 1.88 2021/11/27 20:13:48 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.89 2021/12/14 20:13:13 christos Exp $");
 #endif
 
 #include <ctype.h>
@@ -205,7 +205,7 @@
        kwdef_token(    "__real__",     T_REAL,                 0,0,1,0,1),
        kwdef_sclass(   "register",     REG,                    0,0,0,0,1),
        kwdef_gcc_attr( "regparm",      T_AT_REGPARM),
-       kwdef_tqual(    "restrict",     RESTRICT,               0,1,0,0,5),
+       kwdef_tqual(    "restrict",     RESTRICT,               0,1,0,0,7),
        kwdef_keyword(  "return",       T_RETURN),
        kwdef_gcc_attr( "returns_nonnull",T_AT_RETURNS_NONNULL),
        kwdef_gcc_attr( "returns_twice",T_AT_RETURNS_TWICE),



Home | Main Index | Thread Index | Old Index