@@ -267,7 +267,7 @@ class Parser // NOLINT(readability/identifiers)
267267 bool optStorageSpec (cpp_storage_spect &);
268268 bool optCvQualify (typet &);
269269 bool optAlignas (typet &);
270- bool rAttribute (typet &);
270+ bool rGCCAttribute (typet &);
271271 bool optAttribute (typet &);
272272 bool optIntegralTypeOrClassSpec (typet &);
273273 bool rConstructorDecl (
@@ -852,15 +852,9 @@ bool Parser::rNamespaceSpec(cpp_namespace_spect &namespace_spec)
852852 // inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
853853 // which occurs in glibc. Obviously we need to better than just throw attribs
854854 // 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 ;
864858
865859 switch (lex.LookAhead (0 ))
866860 {
@@ -2073,7 +2067,7 @@ bool Parser::optCvQualify(typet &cv)
20732067 break ;
20742068
20752069 case TOK_GCC_ATTRIBUTE:
2076- if (!rAttribute (cv))
2070+ if (!rGCCAttribute (cv))
20772071 return false ;
20782072 break ;
20792073
@@ -2162,11 +2156,11 @@ bool Parser::optAlignas(typet &cv)
21622156 return false ;
21632157}
21642158
2165- bool Parser::rAttribute (typet &t)
2159+ bool Parser::rGCCAttribute (typet &t)
21662160{
21672161#ifdef DEBUG
21682162 indenter _i;
2169- std::cout << std::string (__indent, ' ' ) << " Parser::rAttribute "
2163+ std::cout << std::string (__indent, ' ' ) << " Parser::rGCCAttribute "
21702164 << lex.LookAhead (0 );
21712165#endif
21722166 cpp_tokent tk;
@@ -2176,7 +2170,7 @@ bool Parser::rAttribute(typet &t)
21762170 {
21772171 case ' (' :
21782172 if (lex.LookAhead (0 )!=' )' )
2179- rAttribute (t);
2173+ rGCCAttribute (t);
21802174
21812175 if (lex.LookAhead (0 )!=' )' )
21822176 return false ;
@@ -2360,11 +2354,19 @@ bool Parser::rAttribute(typet &t)
23602354 if (lex.LookAhead (0 )==' )' )
23612355 return true ;
23622356
2363- return rAttribute (t);
2357+ return rGCCAttribute (t);
23642358}
23652359
23662360bool Parser::optAttribute (typet &t)
23672361{
2362+ if (lex.LookAhead (0 ) == TOK_GCC_ATTRIBUTE)
2363+ {
2364+ lex.get_token ();
2365+
2366+ if (!rGCCAttribute (t))
2367+ return false ;
2368+ }
2369+
23682370 if (lex.LookAhead (0 )!=' [' ||
23692371 lex.LookAhead (1 )!=' [' )
23702372 return true ;
@@ -4487,13 +4489,8 @@ bool Parser::rClassSpec(typet &spec)
44874489 if (!optAlignas (spec))
44884490 return false ;
44894491
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 ;
44974494
44984495 irept name;
44994496
0 commit comments