[cfe-commits] r142349 - /cfe/trunk/lib/Basic/Targets.cpp
Benjamin Kramer
benny.kra at googlemail.com
Tue Oct 18 03:10:08 PDT 2011
Author: d0k
Date: Tue Oct 18 05:10:08 2011
New Revision: 142349
URL: http://llvm.org/viewvc/llvm-project?rev=142349&view=rev
Log:
Use llvm::Triple's methods to parse FreeBSD version numbers.
Who could've thought that FreeBSD would ever reach version 10!
Patch from Dimitry Andric.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=142349&r1=142348&r2=142349&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Oct 18 05:10:08 2011
@@ -247,11 +247,12 @@
MacroBuilder &Builder) const {
// FreeBSD defines; list based off of gcc output
- // FIXME: Move version number handling to llvm::Triple.
- StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1);
+ unsigned Release = Triple.getOSMajorVersion();
+ if (Release == 0U)
+ Release = 8;
- 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__");
More information about the cfe-commits
mailing list