Simplify _declspec like __declspec

This commit is contained in:
PKEuS 2015-04-11 11:02:30 +02:00
parent 42f0955e3f
commit c2ccd7d9e4
2 changed files with 2 additions and 1 deletions

View File

@ -9177,7 +9177,7 @@ void Tokenizer::simplifyCallingConvention()
void Tokenizer::simplifyDeclspec()
{
for (Token *tok = list.front(); tok; tok = tok->next()) {
while (Token::simpleMatch(tok, "__declspec (") && tok->next()->link() && tok->next()->link()->next()) {
while (Token::Match(tok, "__declspec|_declspec (") && tok->next()->link() && tok->next()->link()->next()) {
if (Token::Match(tok->tokAt(2), "noreturn|nothrow")) {
Token *tok1 = tok->next()->link()->next();
while (tok1 && !Token::Match(tok1, "%name%")) {

View File

@ -5068,6 +5068,7 @@ private:
void removedeclspec() {
ASSERT_EQUALS("a b", tokenizeAndStringify("a __declspec ( dllexport ) b"));
ASSERT_EQUALS("a b", tokenizeAndStringify("a _declspec ( dllexport ) b"));
ASSERT_EQUALS("int a ;", tokenizeAndStringify("__declspec(thread) __declspec(align(32)) int a;"));
ASSERT_EQUALS("int i ;", tokenizeAndStringify("__declspec(allocate(\"mycode\")) int i;"));
ASSERT_EQUALS("struct IUnknown ;", tokenizeAndStringify("struct __declspec(uuid(\"00000000-0000-0000-c000-000000000046\")) IUnknown;"));