]> granicus.if.org Git - clang/commitdiff
Define _GNU_SOURCE for rtems c++
authorJames Y Knight <jyknight@google.com>
Wed, 14 Jun 2017 17:01:18 +0000 (17:01 +0000)
committerJames Y Knight <jyknight@google.com>
Wed, 14 Jun 2017 17:01:18 +0000 (17:01 +0000)
This is required by the libc++ locale support.

Patch by Walter Lee.

Differential Revision: https://reviews.llvm.org/D34105

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305399 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/init.c

index a3b8330707b9b7c3d87a3a14246a5a198e69a900..3bf20fef5d22e439e060bc41874de95e944880ca 100644 (file)
@@ -4734,6 +4734,9 @@ protected:
 
     Builder.defineMacro("__rtems__");
     Builder.defineMacro("__ELF__");
+    // Required by the libc++ locale support.
+    if (Opts.CPlusPlus)
+      Builder.defineMacro("_GNU_SOURCE");
   }
 
 public:
index 0bd9e9784599b77e036e52297ef248d02ec450c8..f7540a6322fef526659e1dfb6a14b887ac7199cc 100644 (file)
 // KFREEBSDI686-DEFINE:#define __GLIBC__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GNUSOURCE %s
+// RUN: %clang_cc1 -x c++ -triple sparc-rtems-elf -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GNUSOURCE %s
 // GNUSOURCE:#define _GNU_SOURCE 1
 //
 // RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix NORTTI %s