[PATCH] D34105: Define _GNU_SOURCE for rtems c++

Walter Lee via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 08:53:40 PDT 2017


waltl created this revision.

This is required by the libc++ locale support.


https://reviews.llvm.org/D34105

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


Index: test/Preprocessor/init.c
===================================================================
--- test/Preprocessor/init.c
+++ 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
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4734,6 +4734,9 @@
 
     Builder.defineMacro("__rtems__");
     Builder.defineMacro("__ELF__");
+    // Required by the libc++ locale support.
+    if (Opts.CPlusPlus)
+      Builder.defineMacro("_GNU_SOURCE");
   }
 
 public:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34105.102188.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170612/7f8cdb16/attachment.bin>


More information about the cfe-commits mailing list