From: Walter Lee Date: Wed, 2 Aug 2017 14:36:52 +0000 (+0000) Subject: Define _GNU_SOURCE for RTEMS c++ X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9009e558ab4d45eefae9d11d24951a61c3bb54b;p=clang Define _GNU_SOURCE for RTEMS c++ Summary: This is required by the libc++ locale support. Reviewers: jyknight Subscribers: fedor.sergeev Differential Revision: https://reviews.llvm.org/D36121 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309815 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h index 519a35b06f..ca84a875de 100644 --- a/lib/Basic/Targets/OSTargets.h +++ b/lib/Basic/Targets/OSTargets.h @@ -505,6 +505,8 @@ protected: Builder.defineMacro("__rtems__"); Builder.defineMacro("__ELF__"); + if (Opts.CPlusPlus) + Builder.defineMacro("_GNU_SOURCE"); } public: diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 7b742b3234..11f05e6241 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -8955,6 +8955,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