summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Basic
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-05-20 17:38:45 +0000
committerdim <dim@FreeBSD.org>2016-05-20 17:38:45 +0000
commit8692d6dbafb81c0cf0ca972b3ff89921d9954693 (patch)
treec2c80efb9c96812fe30ca4880134f77f0dbe5938 /contrib/llvm/tools/clang/lib/Basic
parent38da92cdf3d2e4e79de23a2cac45469eb3a03ec1 (diff)
downloadFreeBSD-src-8692d6dbafb81c0cf0ca972b3ff89921d9954693.zip
FreeBSD-src-8692d6dbafb81c0cf0ca972b3ff89921d9954693.tar.gz
Pull in r270240 from upstream clang trunk (by me):
Make __FreeBSD_cc_version predefined macro configurable at build time The `FreeBSDTargetInfo` class has always set the `__FreeBSD_cc_version` predefined macro to a rather static value, calculated from the major OS version. In the FreeBSD base system, we will start incrementing the value of this macro whenever we make any signifant change to clang, so we need a way to configure the macro's value at build time. Use `FREEBSD_CC_VERSION` for this, which we can define in the FreeBSD build system using either the `-D` command line option, or an include file. Stock builds will keep the earlier value. Differential Revision: http://reviews.llvm.org/D20037 Follow-up commits will start using the __FreeBSD_cc_version to determine whether a bootstrap compiler has to be built during buildworld.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Basic')
-rw-r--r--contrib/llvm/tools/clang/lib/Basic/Targets.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
index af8aea0..2564c21 100644
--- a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
+++ b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
@@ -296,6 +296,10 @@ public:
}
};
+#ifndef FREEBSD_CC_VERSION
+#define FREEBSD_CC_VERSION 0U
+#endif
+
// FreeBSD Target
template<typename Target>
class FreeBSDTargetInfo : public OSTargetInfo<Target> {
@@ -306,10 +310,13 @@ protected:
unsigned Release = Triple.getOSMajorVersion();
if (Release == 0U)
- Release = 8;
+ Release = 8U;
+ unsigned CCVersion = FREEBSD_CC_VERSION;
+ if (CCVersion == 0U)
+ CCVersion = Release * 100000U + 1U;
Builder.defineMacro("__FreeBSD__", Twine(Release));
- Builder.defineMacro("__FreeBSD_cc_version", Twine(Release * 100000U + 1U));
+ Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion));
Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
DefineStd(Builder, "unix", Opts);
Builder.defineMacro("__ELF__");
OpenPOWER on IntegriCloud