Module Name: src
Committed By: christos
Date: Tue Mar 23 20:57:40 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y lex.c
Log Message:
Add _Alignas()
To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint1/lex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.198 src/usr.bin/xlint/lint1/cgram.y:1.199
--- src/usr.bin/xlint/lint1/cgram.y:1.198 Tue Mar 23 14:40:50 2021
+++ src/usr.bin/xlint/lint1/cgram.y Tue Mar 23 16:57:40 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.198 2021/03/23 18:40:50 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.199 2021/03/23 20:57:40 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.198 2021/03/23 18:40:50 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.199 2021/03/23 20:57:40 christos Exp $");
#endif
#include <limits.h>
@@ -123,7 +123,7 @@ anonymize(sym_t *s)
}
%}
-%expect 134
+%expect 165
%union {
val_t *y_val;
@@ -149,6 +149,7 @@ anonymize(sym_t *s)
%token T_BUILTIN_OFFSETOF
%token T_TYPEOF
%token T_EXTENSION
+%token T_ALIGNAS
%token T_ALIGNOF
%token T_ASTERISK
%token <y_op> T_MULTIPLICATIVE
@@ -605,12 +606,19 @@ type_attribute_spec_list:
| type_attribute_spec_list T_COMMA type_attribute_spec
;
+align_as:
+ typespec
+ | constant_expr
+ ;
+
type_attribute:
T_ATTRIBUTE T_LPAREN T_LPAREN {
attron = true;
} type_attribute_spec_list {
attron = false;
} T_RPAREN T_RPAREN
+ | T_ALIGNAS T_LPAREN align_as T_RPAREN {
+ }
| T_PACKED {
addpacked();
}
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.15 src/usr.bin/xlint/lint1/lex.c:1.16
--- src/usr.bin/xlint/lint1/lex.c:1.15 Sun Mar 21 10:49:21 2021
+++ src/usr.bin/xlint/lint1/lex.c Tue Mar 23 16:57:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.15 2021/03/21 14:49:21 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.16 2021/03/23 20:57:40 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.15 2021/03/21 14:49:21 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.16 2021/03/23 20:57:40 christos Exp $");
#endif
#include <ctype.h>
@@ -135,6 +135,7 @@ static struct kwtab {
kwdef_type( "__uint128_t", UINT128, 0,1,0,0,1),
#endif
kwdef_tqual( "__thread", THREAD, 0,0,1,0,1),
+ kwdef_token( "_Alignas", T_ALIGNAS, 0,0,0,0,1),
kwdef_token( "_Alignof", T_ALIGNOF, 0,0,0,0,1),
kwdef_type( "_Bool", BOOL, 0,1,0,0,1),
kwdef_type( "_Complex", COMPLEX, 0,1,0,0,1),