forked from OSchip/llvm-project
Sink the _GNU_SOURCE definition down into the target configuration,
and only define it where we know we need it---Linux and Cygwin. Thanks to Chris for the prodding. llvm-svn: 101989
This commit is contained in:
parent
58c65652a8
commit
3ecc665505
|
@ -219,6 +219,8 @@ protected:
|
|||
Builder.defineMacro("__ELF__");
|
||||
if (Opts.POSIXThreads)
|
||||
Builder.defineMacro("_REENTRANT");
|
||||
if (Opts.CPlusPlus)
|
||||
Builder.defineMacro("_GNU_SOURCE");
|
||||
}
|
||||
public:
|
||||
LinuxTargetInfo(const std::string& triple)
|
||||
|
@ -1221,6 +1223,8 @@ public:
|
|||
Builder.defineMacro("__CYGWIN__");
|
||||
Builder.defineMacro("__CYGWIN32__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
if (Opts.CPlusPlus)
|
||||
Builder.defineMacro("_GNU_SOURCE");
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -294,30 +294,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
// C++ translation unit.
|
||||
Builder.defineMacro("__cplusplus", "199711L");
|
||||
Builder.defineMacro("__private_extern__", "extern");
|
||||
|
||||
// Define _GNU_SOURCE on platforms where we expect to use glibc.
|
||||
switch (TI.getTriple().getOS()) {
|
||||
case llvm::Triple::Cygwin:
|
||||
case llvm::Triple::MinGW64:
|
||||
case llvm::Triple::MinGW32:
|
||||
case llvm::Triple::Linux:
|
||||
case llvm::Triple::Solaris:
|
||||
case llvm::Triple::AuroraUX:
|
||||
Builder.defineMacro("_GNU_SOURCE");
|
||||
break;
|
||||
|
||||
case llvm::Triple::Darwin:
|
||||
case llvm::Triple::DragonFly:
|
||||
case llvm::Triple::FreeBSD:
|
||||
case llvm::Triple::UnknownOS:
|
||||
case llvm::Triple::Lv2:
|
||||
case llvm::Triple::NetBSD:
|
||||
case llvm::Triple::OpenBSD:
|
||||
case llvm::Triple::Psp:
|
||||
case llvm::Triple::Win32:
|
||||
case llvm::Triple::Haiku:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (LangOpts.Microsoft) {
|
||||
|
|
Loading…
Reference in New Issue