Skip to content

Commit

Permalink
clang: explicitly enable/disable RTTI support with the compiler
Browse files Browse the repository at this point in the history
Add `-frtti` to the compiler with the base flags case so that RTTI is
enabled by default with clang. Add its inverse analog,
`cxx_no_rtti_flags` in order to test the case with RTTI off, similar to
gcc.

This reduces the amount of testing/support overhead needed in the
non-RTTI case with clang, as the tests currently fail when these two
features are off with version 1.8.1. This something I used in when
investigating test failures on FreeBSD, as the tests that rely on
RTTI were failing with googletest 1.8.1 on the OS platform.

More investigation is being done to determine how this should be fixed
on FreeBSD 11.2-RELEASE with ports, as the package doesn't currently
compile the tests, and when enabled (based on my WIP diff), the tests
fail in similar ways.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
  • Loading branch information
ngie-eign committed Mar 21, 2019
1 parent f957bd0 commit 15a6eb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion googletest/cmake/internal_utils.cmake
Expand Up @@ -78,10 +78,11 @@ macro(config_compiler_and_linker)
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(cxx_base_flags "-Wall -Wshadow -Werror -Wno-error=sign-conversion")
set(cxx_base_flags "-Wall -Wshadow -Werror -Wno-error=sign-conversion -frtti")
set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions")
set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls")
set(cxx_no_rtti_flags "-fno-rtti")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow -Werror")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
Expand Down

0 comments on commit 15a6eb3

Please sign in to comment.