From a4afcb5995b13763ae2915c0a2d49d5a850a5ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 2 Nov 2018 21:07:37 +0100 Subject: [PATCH] Revert "Fixed #8818 (AST broken: restrict)" This reverts commit e7d61f399a995ad6e8540e3a94d6b2e06cc1fc09. --- lib/tokenize.cpp | 14 ++++++++------ test/testsimplifytokens.cpp | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2dbdbd806..4f698ded9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9084,15 +9084,17 @@ void Tokenizer::simplifyKeyword() tok->deleteThis(); } - if (isC() && mSettings->standards.c >= Standards::C99) { + + if (mSettings->standards.c >= Standards::C99) { while (tok->str() == "restrict") { tok->deleteThis(); } - } - // simplify static keyword: - // void foo( int [ static 5 ] ); ==> void foo( int [ 5 ] ); - if (Token::Match(tok, "[ static %num%")) { - tok->deleteNext(); + + // simplify static keyword: + // void foo( int [ static 5 ] ); ==> void foo( int [ 5 ] ); + if (Token::Match(tok, "[ static %num%")) { + tok->deleteNext(); + } } if (mSettings->standards.c >= Standards::C11) { diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 39e6b475c..252e31e60 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -3280,7 +3280,6 @@ private: ASSERT_EQUALS("int * p ;", tok("int * restrict p;", "test.c")); ASSERT_EQUALS("int * * p ;", tok("int * restrict * p;", "test.c")); ASSERT_EQUALS("void foo ( float * a , float * b ) ;", tok("void foo(float * restrict a, float * restrict b);", "test.c")); - ASSERT_EQUALS("void foo ( int restrict ) ;", tok("void foo(int restrict);")); ASSERT_EQUALS("int * p ;", tok("typedef int * __restrict__ rint; rint p;", "test.c")); // don't remove struct members: