@@ -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 {
@@ -1418,6 +1412,10 @@ bool Parser::rDeclaration(cpp_declarationt &declaration)
14181412 if (!optCvQualify (cv_q))
14191413 return false ;
14201414
1415+ if (member_spec.is_empty ())
1416+ if (!optMemberSpec (member_spec))
1417+ return false ;
1418+
14211419 // added these two to do "const static volatile int i=1;"
14221420 if (!optStorageSpec (storage_spec))
14231421 return false ;
@@ -2073,7 +2071,7 @@ bool Parser::optCvQualify(typet &cv)
20732071 break ;
20742072
20752073 case TOK_GCC_ATTRIBUTE:
2076- if (!rAttribute (cv))
2074+ if (!rGCCAttribute (cv))
20772075 return false ;
20782076 break ;
20792077
@@ -2162,11 +2160,11 @@ bool Parser::optAlignas(typet &cv)
21622160 return false ;
21632161}
21642162
2165- bool Parser::rAttribute (typet &t)
2163+ bool Parser::rGCCAttribute (typet &t)
21662164{
21672165#ifdef DEBUG
21682166 indenter _i;
2169- std::cout << std::string (__indent, ' ' ) << " Parser::rAttribute "
2167+ std::cout << std::string (__indent, ' ' ) << " Parser::rGCCAttribute "
21702168 << lex.LookAhead (0 );
21712169#endif
21722170 cpp_tokent tk;
@@ -2176,7 +2174,7 @@ bool Parser::rAttribute(typet &t)
21762174 {
21772175 case ' (' :
21782176 if (lex.LookAhead (0 )!=' )' )
2179- rAttribute (t);
2177+ rGCCAttribute (t);
21802178
21812179 if (lex.LookAhead (0 )!=' )' )
21822180 return false ;
@@ -2360,11 +2358,19 @@ bool Parser::rAttribute(typet &t)
23602358 if (lex.LookAhead (0 )==' )' )
23612359 return true ;
23622360
2363- return rAttribute (t);
2361+ return rGCCAttribute (t);
23642362}
23652363
23662364bool Parser::optAttribute (typet &t)
23672365{
2366+ if (lex.LookAhead (0 ) == TOK_GCC_ATTRIBUTE)
2367+ {
2368+ lex.get_token ();
2369+
2370+ if (!rGCCAttribute (t))
2371+ return false ;
2372+ }
2373+
23682374 if (lex.LookAhead (0 )!=' [' ||
23692375 lex.LookAhead (1 )!=' [' )
23702376 return true ;
@@ -4487,13 +4493,8 @@ bool Parser::rClassSpec(typet &spec)
44874493 if (!optAlignas (spec))
44884494 return false ;
44894495
4490- if (lex.LookAhead (0 )==TOK_GCC_ATTRIBUTE)
4491- {
4492- lex.get_token (tk);
4493-
4494- if (!rAttribute (spec))
4495- return false ;
4496- }
4496+ if (!optAttribute (spec))
4497+ return false ;
44974498
44984499 irept name;
44994500
0 commit comments