[llvm-commits] [llvm] r137111 - /llvm/trunk/lib/Support/Unix/Host.inc
Bob Wilson
bob.wilson at apple.com
Tue Aug 9 12:35:29 PDT 2011
On Aug 9, 2011, at 12:02 PM, Chris Lattner wrote:
>
> On Aug 8, 2011, at 10:13 PM, Bob Wilson wrote:
>
>> Author: bwilson
>> Date: Tue Aug 9 00:13:36 2011
>> New Revision: 137111
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=137111&view=rev
>> Log:
>> Recognize the UNAME_RELEASE environment variable to match Darwin's uname.
>> When this variable is set, "uname -r" will return its value instead of the
>> real OS version. Make this affect LLVM's triple for consistency.
>> <rdar://problem/9919167>
>
> Hi Bob,
>
> Should this be #ifdef __APPLE__ or something?
>
> -Chris
I thought about that but decided that since no one else is likely to set UNAME_RELEASE that it wasn't necessary. I'll take your question as a hint that you would prefer it with the #ifdef.
>
>>
>> Modified:
>> llvm/trunk/lib/Support/Unix/Host.inc
>>
>> Modified: llvm/trunk/lib/Support/Unix/Host.inc
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Host.inc?rev=137111&r1=137110&r2=137111&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Unix/Host.inc (original)
>> +++ llvm/trunk/lib/Support/Unix/Host.inc Tue Aug 9 00:13:36 2011
>> @@ -22,12 +22,18 @@
>> #include <sys/utsname.h>
>> #include <cctype>
>> #include <string>
>> +#include <cstdlib> // ::getenv
>>
>> using namespace llvm;
>>
>> static std::string getOSVersion() {
>> struct utsname info;
>>
>> + // Recognize UNAME_RELEASE environment variable to match Darwin uname.
>> + const char *UnameOverride = ::getenv("UNAME_RELEASE");
>> + if (UnameOverride && UnameOverride[0] != '\0')
>> + return UnameOverride;
>> +
>> if (uname(&info))
>> return "";
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list