Skip to content

Commit 7c0d750

Browse files
author
Daniel Kroening
authored
Merge pull request #2362 from smowton/smowton/fix/tolerate-cxx-namespace-attribute
C++ frontend: tolerate namespace attributes
2 parents e6d196d + 1f1835b commit 7c0d750

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/cpp/parse.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,20 @@ bool Parser::rNamespaceSpec(cpp_namespace_spect &namespace_spec)
856856
namespace_spec.set_namespace(name);
857857
namespace_spec.set_is_inline(is_inline);
858858

859+
// Tolerate constructs such as:
860+
// inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
861+
// which occurs in glibc. Obviously we need to better than just throw attribs
862+
// away like this in the future.
863+
if(lex.LookAhead(0)==TOK_GCC_ATTRIBUTE)
864+
{
865+
cpp_tokent tk;
866+
lex.get_token(tk);
867+
868+
typet discard;
869+
if(!rAttribute(discard))
870+
return false;
871+
}
872+
859873
switch(lex.LookAhead(0))
860874
{
861875
case '{':

0 commit comments

Comments
 (0)