Skip to content

C++ frontend: tolerate namespace attributes #2362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/cpp/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,20 @@ bool Parser::rNamespaceSpec(cpp_namespace_spect &namespace_spec)
namespace_spec.set_namespace(name);
namespace_spec.set_is_inline(is_inline);

// Tolerate constructs such as:
// inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
// which occurs in glibc. Obviously we need to better than just throw attribs
// away like this in the future.
if(lex.LookAhead(0)==TOK_GCC_ATTRIBUTE)
{
cpp_tokent tk;
lex.get_token(tk);

typet discard;
if(!rAttribute(discard))
return false;
}

switch(lex.LookAhead(0))
{
case '{':
Expand Down