Remove "auto" keyword (storage class specifier) from C++03 and C code (#4990).
This commit is contained in:
parent
2d608890a5
commit
3e65cb446e
|
@ -9374,6 +9374,13 @@ void Tokenizer::simplifyKeyword()
|
||||||
tok->deleteThis();
|
tok->deleteThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isC() || _settings->standards.cpp == Standards::CPP03) {
|
||||||
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
|
if (tok->str() == "auto")
|
||||||
|
tok->deleteThis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_settings->standards.c >= Standards::C99) {
|
if (_settings->standards.c >= Standards::C99) {
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
while (tok->str() == "restrict") {
|
while (tok->str() == "restrict") {
|
||||||
|
|
|
@ -7659,6 +7659,8 @@ private:
|
||||||
// don't remove struct members:
|
// don't remove struct members:
|
||||||
ASSERT_EQUALS("a = b . _inline ;", tok("a = b._inline;", true));
|
ASSERT_EQUALS("a = b . _inline ;", tok("a = b._inline;", true));
|
||||||
|
|
||||||
|
ASSERT_EQUALS("int i ; i = 0 ;", tok("auto int i = 0;", "test.c"));
|
||||||
|
ASSERT_EQUALS("auto i ; i = 0 ;", tok("auto i = 0;", "test.cpp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyCallingConvention() {
|
void simplifyCallingConvention() {
|
||||||
|
|
Loading…
Reference in New Issue