From d29b6300a70576f5996f4137536e3ca1efa8eb83 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 5 Oct 2008 21:50:58 +0000 Subject: [PATCH] miscellaneous cleanups git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57140 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets.cpp | 52 +++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 424be5f268..016f88e498 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -33,11 +33,38 @@ static void Define(std::vector &Buf, const char *Macro, Buf.push_back('\n'); } +//===----------------------------------------------------------------------===// +// Defines specific to certain operating systems. +//===----------------------------------------------------------------------===// + static void getSolarisDefines(std::vector &Defs) { Define(Defs, "__SUN__"); Define(Defs, "__SOLARIS__"); } +static void getDragonFlyDefines(std::vector &Defs) { + // DragonFly defines; list based off of gcc output + Define(Defs, "__DragonFly__"); + Define(Defs, "__DragonFly_cc_version", "100001"); + Define(Defs, "__ELF__"); + Define(Defs, "__KPRINTF_ATTRIBUTE__"); + Define(Defs, "__tune_i386__"); + Define(Defs, "unix"); + Define(Defs, "__unix"); + Define(Defs, "__unix__"); +} + +static void getLinuxDefines(std::vector &Defs) { + // Linux defines; list based off of gcc output + Define(Defs, "__unix__"); + Define(Defs, "__unix"); + Define(Defs, "unix"); + Define(Defs, "__linux__"); + Define(Defs, "__linux"); + Define(Defs, "linux"); + Define(Defs, "__gnu_linux__"); +} + static void getDarwinDefines(std::vector &Defs, const char *Triple) { Define(Defs, "__APPLE__"); Define(Defs, "__MACH__"); @@ -72,28 +99,9 @@ static void getDarwinDefines(std::vector &Defs, const char *Triple) { } } -static void getDragonFlyDefines(std::vector &Defs) { - // DragonFly defines; list based off of gcc output - Define(Defs, "__DragonFly__"); - Define(Defs, "__DragonFly_cc_version", "100001"); - Define(Defs, "__ELF__"); - Define(Defs, "__KPRINTF_ATTRIBUTE__"); - Define(Defs, "__tune_i386__"); - Define(Defs, "unix"); - Define(Defs, "__unix"); - Define(Defs, "__unix__"); -} - -static void getLinuxDefines(std::vector &Defs) { - // Linux defines; list based off of gcc output - Define(Defs, "__unix__"); - Define(Defs, "__unix"); - Define(Defs, "unix"); - Define(Defs, "__linux__"); - Define(Defs, "__linux"); - Define(Defs, "linux"); - Define(Defs, "__gnu_linux__"); -} +//===----------------------------------------------------------------------===// +// Defines specific to certain architectures. +//===----------------------------------------------------------------------===// /// getPowerPCDefines - Return a set of the PowerPC-specific #defines that are /// not tied to a specific subtarget. -- 2.40.0