Skip to content

Commit

Permalink
Do not define GXX_RTTI macro for C.
Browse files Browse the repository at this point in the history
This is same as GCC behavior (tested with GCC 4.8.2).

Differential Revision: http://reviews.llvm.org/D16365

llvm-svn: 258850
  • Loading branch information
Yunzhong Gao authored and Yunzhong Gao committed Jan 26, 2016
1 parent 4a93316 commit bacf7e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Expand Up @@ -1669,7 +1669,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);

Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
Opts.Blocks = Args.hasArg(OPT_fblocks);
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
Expand Down
13 changes: 8 additions & 5 deletions clang/test/Preprocessor/init.c
Expand Up @@ -57,6 +57,10 @@
//
// C99:#define __STDC_VERSION__ 199901L
// C99:#define __STRICT_ANSI__ 1
// C99-NOT: __GXX_EXPERIMENTAL_CXX0X__
// C99-NOT: __GXX_RTTI
// C99-NOT: __GXX_WEAK__
// C99-NOT: __cplusplus
//
//
// RUN: %clang_cc1 -std=c11 -E -dM < /dev/null | FileCheck -check-prefix C11 %s
Expand All @@ -65,6 +69,10 @@
// C11:#define __STDC_UTF_32__ 1
// C11:#define __STDC_VERSION__ 201112L
// C11:#define __STRICT_ANSI__ 1
// C11-NOT: __GXX_EXPERIMENTAL_CXX0X__
// C11-NOT: __GXX_RTTI
// C11-NOT: __GXX_WEAK__
// C11-NOT: __cplusplus
//
//
// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
Expand Down Expand Up @@ -3286,7 +3294,6 @@
// MIPSN32BE: #define __GNUC_STDC_INLINE__ 1
// MIPSN32BE: #define __GNUC__ 4
// MIPSN32BE: #define __GXX_ABI_VERSION 1002
// MIPSN32BE: #define __GXX_RTTI 1
// MIPSN32BE: #define __ILP32__ 1
// MIPSN32BE: #define __INT16_C_SUFFIX__
// MIPSN32BE: #define __INT16_FMTd__ "hd"
Expand Down Expand Up @@ -3592,7 +3599,6 @@
// MIPSN32EL: #define __GNUC_STDC_INLINE__ 1
// MIPSN32EL: #define __GNUC__ 4
// MIPSN32EL: #define __GXX_ABI_VERSION 1002
// MIPSN32EL: #define __GXX_RTTI 1
// MIPSN32EL: #define __ILP32__ 1
// MIPSN32EL: #define __INT16_C_SUFFIX__
// MIPSN32EL: #define __INT16_FMTd__ "hd"
Expand Down Expand Up @@ -7618,7 +7624,6 @@
// X86_64-CLOUDABI:#define __GNUC_STDC_INLINE__ 1
// X86_64-CLOUDABI:#define __GNUC__ 4
// X86_64-CLOUDABI:#define __GXX_ABI_VERSION 1002
// X86_64-CLOUDABI:#define __GXX_RTTI 1
// X86_64-CLOUDABI:#define __INT16_C_SUFFIX__
// X86_64-CLOUDABI:#define __INT16_FMTd__ "hd"
// X86_64-CLOUDABI:#define __INT16_FMTi__ "hi"
Expand Down Expand Up @@ -8483,7 +8488,6 @@
// WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
// WEBASSEMBLY32-NEXT:#define __GNUC__ {{.}}
// WEBASSEMBLY32-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
// WEBASSEMBLY32-NEXT:#define __GXX_RTTI 1{{$}}
// WEBASSEMBLY32-NEXT:#define __ILP32__ 1{{$}}
// WEBASSEMBLY32-NEXT:#define __INT16_C_SUFFIX__ {{$}}
// WEBASSEMBLY32-NEXT:#define __INT16_FMTd__ "hd"{{$}}
Expand Down Expand Up @@ -8799,7 +8803,6 @@
// WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
// WEBASSEMBLY64-NEXT:#define __GNUC__ {{.}}
// WEBASSEMBLY64-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
// WEBASSEMBLY64-NEXT:#define __GXX_RTTI 1{{$}}
// WEBASSEMBLY64-NOT:#define __ILP32__
// WEBASSEMBLY64-NEXT:#define __INT16_C_SUFFIX__ {{$}}
// WEBASSEMBLY64-NEXT:#define __INT16_FMTd__ "hd"{{$}}
Expand Down

0 comments on commit bacf7e4

Please sign in to comment.