@@ -267,7 +267,7 @@ class Parser // NOLINT(readability/identifiers)
267
267
bool optStorageSpec (cpp_storage_spect &);
268
268
bool optCvQualify (typet &);
269
269
bool optAlignas (typet &);
270
- bool rAttribute (typet &);
270
+ bool rGCCAttribute (typet &);
271
271
bool optAttribute (typet &);
272
272
bool optIntegralTypeOrClassSpec (typet &);
273
273
bool rConstructorDecl (
@@ -852,15 +852,9 @@ bool Parser::rNamespaceSpec(cpp_namespace_spect &namespace_spec)
852
852
// inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
853
853
// which occurs in glibc. Obviously we need to better than just throw attribs
854
854
// away like this in the future.
855
- if (lex.LookAhead (0 )==TOK_GCC_ATTRIBUTE)
856
- {
857
- cpp_tokent tk;
858
- lex.get_token (tk);
859
-
860
- typet discard;
861
- if (!rAttribute (discard))
862
- return false ;
863
- }
855
+ typet discard;
856
+ if (!optAttribute (discard))
857
+ return false ;
864
858
865
859
switch (lex.LookAhead (0 ))
866
860
{
@@ -2073,7 +2067,7 @@ bool Parser::optCvQualify(typet &cv)
2073
2067
break ;
2074
2068
2075
2069
case TOK_GCC_ATTRIBUTE:
2076
- if (!rAttribute (cv))
2070
+ if (!rGCCAttribute (cv))
2077
2071
return false ;
2078
2072
break ;
2079
2073
@@ -2162,11 +2156,11 @@ bool Parser::optAlignas(typet &cv)
2162
2156
return false ;
2163
2157
}
2164
2158
2165
- bool Parser::rAttribute (typet &t)
2159
+ bool Parser::rGCCAttribute (typet &t)
2166
2160
{
2167
2161
#ifdef DEBUG
2168
2162
indenter _i;
2169
- std::cout << std::string (__indent, ' ' ) << " Parser::rAttribute "
2163
+ std::cout << std::string (__indent, ' ' ) << " Parser::rGCCAttribute "
2170
2164
<< lex.LookAhead (0 );
2171
2165
#endif
2172
2166
cpp_tokent tk;
@@ -2176,7 +2170,7 @@ bool Parser::rAttribute(typet &t)
2176
2170
{
2177
2171
case ' (' :
2178
2172
if (lex.LookAhead (0 )!=' )' )
2179
- rAttribute (t);
2173
+ rGCCAttribute (t);
2180
2174
2181
2175
if (lex.LookAhead (0 )!=' )' )
2182
2176
return false ;
@@ -2360,11 +2354,19 @@ bool Parser::rAttribute(typet &t)
2360
2354
if (lex.LookAhead (0 )==' )' )
2361
2355
return true ;
2362
2356
2363
- return rAttribute (t);
2357
+ return rGCCAttribute (t);
2364
2358
}
2365
2359
2366
2360
bool Parser::optAttribute (typet &t)
2367
2361
{
2362
+ if (lex.LookAhead (0 ) == TOK_GCC_ATTRIBUTE)
2363
+ {
2364
+ lex.get_token ();
2365
+
2366
+ if (!rGCCAttribute (t))
2367
+ return false ;
2368
+ }
2369
+
2368
2370
if (lex.LookAhead (0 )!=' [' ||
2369
2371
lex.LookAhead (1 )!=' [' )
2370
2372
return true ;
@@ -4487,13 +4489,8 @@ bool Parser::rClassSpec(typet &spec)
4487
4489
if (!optAlignas (spec))
4488
4490
return false ;
4489
4491
4490
- if (lex.LookAhead (0 )==TOK_GCC_ATTRIBUTE)
4491
- {
4492
- lex.get_token (tk);
4493
-
4494
- if (!rAttribute (spec))
4495
- return false ;
4496
- }
4492
+ if (!optAttribute (spec))
4493
+ return false ;
4497
4494
4498
4495
irept name;
4499
4496
0 commit comments