This commit is contained in:
Roman Zaytsev Borisovich 2013-05-30 17:13:09 +04:00
parent 065853a59a
commit 4610b135dc
3 changed files with 19 additions and 1 deletions

View File

@ -799,7 +799,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
if (scope->definedType->needInitialization == Type::Unknown)
unknowns++;
}
} else if (scope->type == Scope::eUnion && scope->definedType->needInitialization == Type::Unknown)
} else if (scope->type == Scope::eUnion && scope->definedType && scope->definedType->needInitialization == Type::Unknown)
scope->definedType->needInitialization = Type::True;
}

View File

@ -8642,6 +8642,14 @@ void Tokenizer::simplifyKeyword()
}
}
if (_settings->standards.c >= Standards::C11) {
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (tok->str() == "_Atomic") {
tok->deleteThis();
}
}
}
if (_settings->standards.cpp >= Standards::CPP11) {
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (Token::Match(tok, "constexpr|override")) {

View File

@ -191,6 +191,7 @@ private:
TEST_CASE(symboldatabase30);
TEST_CASE(symboldatabase31);
TEST_CASE(symboldatabase33); // ticket #4682 (false negatives)
TEST_CASE(symboldatabase34); // ticket #4694 (segmentation fault)
TEST_CASE(isImplicitlyVirtual);
@ -1496,6 +1497,15 @@ private:
ASSERT(db && db->functionScopes.size() == 1);
}
void symboldatabase34() { // ticket #4694
check("typedef _Atomic(int(A::*)) atomic_mem_ptr_to_int;\n"
"typedef _Atomic(int)&atomic_int_ref;\n"
"struct S {\n"
" _Atomic union { int n; };\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"