diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 28d3a6d5f..35057c4a3 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2041,6 +2041,9 @@ bool Tokenizer::tokenize(std::istream &code, } } + // Remove "volatile", "inline", "register", and "restrict" + simplifyKeyword(); + // Convert K&R function declarations to modern C simplifyVarDecl(true); if (!simplifyFunctionParameters()) @@ -2097,9 +2100,6 @@ bool Tokenizer::tokenize(std::istream &code, // remove Borland stuff.. simplifyBorland(); - // Remove "volatile", "inline", "register", and "restrict" - simplifyKeyword(); - // Remove __builtin_expect, likely and unlikely simplifyBuiltinExpect(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index f29978bdc..8e825efd6 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4787,6 +4787,15 @@ private: "{\n" "}", tokenizeAndStringify(code)); } + { + const char code[] = "void f(a, b) register char *a, *b;\n" + "{\n" + "}\n"; + + ASSERT_EQUALS("void f ( char * a , char * b )\n" + "{\n" + "}", tokenizeAndStringify(code)); + } } void vardecl20() {