[PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added reviewers: bogner, echristo.
beanz added a subscriber: cfe-commits.

The code comments in the Makefile indicate this was put in place to support 
issues when building clang with GCC. Today clang's strict aliasing works, so we 
shouldn't pass -fno-strict-aliasing when building with clang.

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
+
 
 # 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)


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
+
 
 # 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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Chris Bieneman via cfe-commits
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
+
 
 # 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)


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
+
 
 # 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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Eric Christopher via cfe-commits
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  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
> +
>
>  # 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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread David Blaikie via cfe-commits
Have you tested this? I assume there are strict aliasing violations in
Clang/LLVM if we've had this turned on for a while.

(does strict aliasing still have the special case for enum type punning?
Becaues I've certainly seen (& fixed) that in a few places in Clang/LLVM)

On Fri, Aug 14, 2015 at 10:39 AM, Chris Bieneman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> beanz created this revision.
> beanz added reviewers: bogner, echristo.
> beanz added a subscriber: cfe-commits.
>
> The code comments in the Makefile indicate this was put in place to
> support issues when building clang with GCC. Today clang's strict aliasing
> works, so we shouldn't pass -fno-strict-aliasing when building with clang.
>
> 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
> +
>
>  # 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@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Eric Christopher via cfe-commits" 
> To: reviews+d12036+public+3cb5bf37e2ab4...@reviews.llvm.org, 
> m...@justinbogner.com
> Cc: cfe-commits@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 < be...@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@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Chris Bieneman via cfe-commits
beanz added a comment.

dblaikie,

I've run this through check-all with no issues.


http://reviews.llvm.org/D12036



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Chris Bieneman via cfe-commits
beanz added a comment.

echristo,

I can move the makefile check to the autoconf check, but I think setting the 
flags should stay in the clang CMakeLists/Makefile otherwise it will change 
behavior. Today we only enable this flag for the clang subdirectory, not all of 
LLVM.

Thoughts?


http://reviews.llvm.org/D12036



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> beanz added a comment.
>
> dblaikie,
>
> I've run this through check-all with no issues.

Might want to bootstrap with sanitizers or something. Strict aliasing
related bugs can be subtle.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Chris Bieneman via cfe-commits
Ok… I wrote some CMake goop to enable sanitizers on a bootstrap build (I’ll 
clean up the patches and send those out separately). check-clang worked with 
asan and ubsan enabled.

Is that sufficient pre-commit testing?

I still need to rework the Makefile side of the patch to match Eric’s 
suggestion.

-Chris

> On Aug 14, 2015, at 11:14 AM, Justin Bogner  wrote:
> 
> Chris Bieneman  writes:
>> beanz added a comment.
>> 
>> dblaikie,
>> 
>> I've run this through check-all with no issues.
> 
> Might want to bootstrap with sanitizers or something. Strict aliasing
> related bugs can be subtle.

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> Ok… I wrote some CMake goop to enable sanitizers on a bootstrap build
> (I’ll clean up the patches and send those out separately). check-clang
> worked with asan and ubsan enabled.
>
> Is that sufficient pre-commit testing?

Yes, I'd expect that to shake out any problems.

> I still need to rework the Makefile side of the patch to match Eric’s
> suggestion.

Hal also suggested checking for the __clang__ define rather than
checking the compiler name. That seems better to me.


David Blaikie  writes:
> (does strict aliasing still have the special case for enum type
> punning?  Because I've certainly seen (& fixed) that in a few places
> in Clang/LLVM)

I'm sure it does - this pattern is used pretty pervasively.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-14 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.


Comment at: Makefile:68
@@ -67,3 +67,3 @@
 #   http://gcc.gnu.org/PR41874
 #   http://gcc.gnu.org/PR41838
 #

The first of these is marked fixed, the second has a "works on trunk" comment 
(from 2010). Maybe this isn't needed with gcc anymore either?


http://reviews.llvm.org/D12036



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-17 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 32349.
beanz added a comment.

- Adapting to r245255 which exposes a variable in autoconf for which compiler 
you are building with.
- Updated the CMake to be more CMake-y

Note: This has been tested by running a check on a stage2 clang built with asan 
and ubsan.


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 ($(CXX_COMPILER), "clang")
 CXX.Flags += -fno-strict-aliasing
+endif
+
 
 # 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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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)


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 ($(CXX_COMPILER), "clang")
 CXX.Flags += -fno-strict-aliasing
+endif
+
 
 # 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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-17 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> beanz updated this revision to Diff 32349.
> beanz added a comment.
>
> - Adapting to r245255 which exposes a variable in autoconf for which
> compiler you are building with.
> - Updated the CMake to be more CMake-y
>
> Note: This has been tested by running a check on a stage2 clang built
> with asan and ubsan.

LGTM.

>
> 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 ($(CXX_COMPILER), "clang")
>  CXX.Flags += -fno-strict-aliasing
> +endif
> +
>  
>  # 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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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)
>
>
> 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 ($(CXX_COMPILER), "clang")
>  CXX.Flags += -fno-strict-aliasing
> +endif
> +
>  
>  # 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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-17 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Sure I guess. I'm still not sure why we can't do this in the configure side of 
things, but I don't really care that much for now.


http://reviews.llvm.org/D12036



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12036: We shouldn't need to pass -fno-strict-aliasing when building clang with clang.

2015-08-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245304: We shouldn't need to pass -fno-strict-aliasing when 
building clang with clang. (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D12036?vs=32349&id=32420#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12036

Files:
  cfe/trunk/CMakeLists.txt
  cfe/trunk/Makefile

Index: cfe/trunk/Makefile
===
--- cfe/trunk/Makefile
+++ cfe/trunk/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 ($(CXX_COMPILER), "clang")
 CXX.Flags += -fno-strict-aliasing
+endif
+
 
 # Set up Clang's tblgen.
 ifndef CLANG_TBLGEN
Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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)


Index: cfe/trunk/Makefile
===
--- cfe/trunk/Makefile
+++ cfe/trunk/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 ($(CXX_COMPILER), "clang")
 CXX.Flags += -fno-strict-aliasing
+endif
+
 
 # Set up Clang's tblgen.
 ifndef CLANG_TBLGEN
Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/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 "${CMAKE_CXX_COMPILER_ID}" MATCHES "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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits