[PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.
Hal Finkel via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 11:03:11 PDT 2015
----- Original Message -----
> From: "Eric Christopher via cfe-commits" <cfe-commits at lists.llvm.org>
> To: reviews+D12036+public+3cb5bf37e2ab4144 at reviews.llvm.org, mail at justinbogner.com
> Cc: cfe-commits at lists.llvm.org
> Sent: Friday, August 14, 2015 12:50:09 PM
> Subject: Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.
>
>
>
>
> This is fine, but would you mind moving it to the cmake and autoconf
> checks respectively? Probably near the warning checks where we
> already check for compiler.
>
>
> On Fri, Aug 14, 2015, 10:41 AM Chris Bieneman < beanz at apple.com >
> wrote:
>
>
> beanz updated this revision to Diff 32163.
> beanz added a comment.
>
> Should have been calling $(CC) not cc in the makefile. Oops.
>
>
> http://reviews.llvm.org/D12036
>
> Files:
> CMakeLists.txt
> Makefile
>
> Index: Makefile
> ===================================================================
> --- Makefile
> +++ Makefile
> @@ -67,8 +67,11 @@
> # http://gcc.gnu.org/PR41874
> # http://gcc.gnu.org/PR41838
> #
> -# We can revisit this when LLVM/Clang support it.
> +# We don't need to do this if the host compiler is clang.
> +ifeq ($(shell $(CC) -v 2>&1 | grep clang), "")
> CXX.Flags += -fno-strict-aliasing
> +endif
Shouldn't we check whether the compiler defines __clang__ instead of checking the executable name?
-Hal
> +
>
> # Set up Clang's tblgen.
> ifndef CLANG_TBLGEN
> Index: CMakeLists.txt
> ===================================================================
> --- CMakeLists.txt
> +++ CMakeLists.txt
> @@ -253,7 +253,10 @@
>
> # Add appropriate flags for GCC
> if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
> - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common
> -Woverloaded-virtual -fno-strict-aliasing")
> + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common
> -Woverloaded-virtual")
> + if (NOT LLVM_COMPILER_IS_CLANG)
> + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
> + endif ()
>
> # Enable -pedantic for Clang even if it's not enabled for LLVM.
> if (NOT LLVM_ENABLE_PEDANTIC)
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the cfe-commits
mailing list