Fix the way clang retrieves the major FreeBSD release number from the
target triple, so that the __FreeBSD__ and __FreeBSD_cc_version builtin macros return the expected results. Spotted by: nalitoja at gmail.com
This commit is contained in:
parent
29550c285c
commit
486b1da765
@ -238,11 +238,12 @@ class FreeBSDTargetInfo : public OSTargetInfo<Target> {
|
||||
MacroBuilder &Builder) const {
|
||||
// FreeBSD defines; list based off of gcc output
|
||||
|
||||
// FIXME: Move version number handling to llvm::Triple.
|
||||
llvm::StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1);
|
||||
unsigned Release = Triple.getOSMajorVersion();
|
||||
if (Release == 0U)
|
||||
Release = 8U;
|
||||
|
||||
Builder.defineMacro("__FreeBSD__", Release);
|
||||
Builder.defineMacro("__FreeBSD_cc_version", Release + "00001");
|
||||
Builder.defineMacro("__FreeBSD__", Twine(Release));
|
||||
Builder.defineMacro("__FreeBSD_cc_version", Twine(Release * 100000U + 1U));
|
||||
Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
Builder.defineMacro("__ELF__");
|
||||
|
Loading…
Reference in New Issue
Block a user