Do not simplify name "CALLBACK" away on non-windows platforms (#7554)

This commit is contained in:
PKEuS 2016-07-16 10:43:28 +02:00
parent 768c26805c
commit 0afecd8fee
2 changed files with 9 additions and 4 deletions

View File

@ -8471,8 +8471,10 @@ void Tokenizer::simplifyStructDecl()
void Tokenizer::simplifyCallingConvention()
{
bool windows = _settings->isWindowsPlatform();
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (Token::Match(tok, "__cdecl|__stdcall|__fastcall|__thiscall|__clrcall|__syscall|__pascal|__fortran|__far|__near|WINAPI|APIENTRY|CALLBACK")) {
while (Token::Match(tok, "__cdecl|__stdcall|__fastcall|__thiscall|__clrcall|__syscall|__pascal|__fortran|__far|__near") || (windows && Token::Match(tok, "WINAPI|APIENTRY|CALLBACK"))) {
tok->deleteThis();
}
}

View File

@ -3258,9 +3258,12 @@ private:
ASSERT_EQUALS("int f ( ) ;", tok("int __far __syscall f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int __far __pascal f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int __far __fortran f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int WINAPI f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int APIENTRY f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int CALLBACK f();", true));
ASSERT_EQUALS("int f ( ) ;", tok("int WINAPI f();", true, Settings::Win32A));
ASSERT_EQUALS("int f ( ) ;", tok("int APIENTRY f();", true, Settings::Win32A));
ASSERT_EQUALS("int f ( ) ;", tok("int CALLBACK f();", true, Settings::Win32A));
// don't simplify Microsoft defines in unix code (#7554)
ASSERT_EQUALS("enum E { CALLBACK } ;", tok("enum E { CALLBACK } ;", true, Settings::Unix32));
}
void simplifyFunctorCall() {