From: James Y Knight Date: Wed, 14 Jun 2017 17:01:18 +0000 (+0000) Subject: Define _GNU_SOURCE for rtems c++ X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bc0fd65768207f29db8881463167c0956893b19;p=clang Define _GNU_SOURCE for rtems c++ 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 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index a3b8330707..3bf20fef5d 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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: diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 0bd9e97845..f7540a6322 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -8779,6 +8779,7 @@ // 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