lib/Basic/Targets.cpp: __declspec(attr) should be provided on mingw as macro, alias of __attribute__.

On mingw without -fms-extensions, we can provide "as-is" __declspec.

llvm-svn: 127655
This commit is contained in:
NAKAMURA Takumi 2011-03-15 02:32:50 +00:00
parent 1a780ee8a9
commit b2beb018b8
1 changed files with 18 additions and 2 deletions

View File

@ -1481,7 +1481,15 @@ public:
Builder.defineMacro("_X86_");
Builder.defineMacro("__MSVCRT__");
Builder.defineMacro("__MINGW32__");
Builder.defineMacro("__declspec", "__declspec");
// mingw32-gcc provides __declspec(a) as alias of __attribute__((a)).
// In contrast, clang-cc1 provides __declspec(a) with -fms-extensions.
if (Opts.Microsoft)
// Provide "as-is" __declspec.
Builder.defineMacro("__declspec", "__declspec");
else
// Provide alias of __attribute__ like mingw32-gcc.
Builder.defineMacro("__declspec(a)", "__attribute__((a))");
}
};
} // end anonymous namespace
@ -1631,7 +1639,15 @@ public:
Builder.defineMacro("__MSVCRT__");
Builder.defineMacro("__MINGW32__");
Builder.defineMacro("__MINGW64__");
Builder.defineMacro("__declspec", "__declspec");
// mingw32-gcc provides __declspec(a) as alias of __attribute__((a)).
// In contrast, clang-cc1 provides __declspec(a) with -fms-extensions.
if (Opts.Microsoft)
// Provide "as-is" __declspec.
Builder.defineMacro("__declspec", "__declspec");
else
// Provide alias of __attribute__ like mingw32-gcc.
Builder.defineMacro("__declspec(a)", "__attribute__((a))");
}
};
} // end anonymous namespace