[flang-commits] [flang] 81bf1e2 - [flang] Fix release build flags.

David Truby via flang-commits flang-commits at lists.llvm.org
Tue Jun 2 08:29:29 PDT 2020


Author: David Truby
Date: 2020-06-02T16:29:12+01:00
New Revision: 81bf1e29aae5992db318803ba4722a585ad64638

URL: https://github.com/llvm/llvm-project/commit/81bf1e29aae5992db318803ba4722a585ad64638
DIFF: https://github.com/llvm/llvm-project/commit/81bf1e29aae5992db318803ba4722a585ad64638.diff

LOG: [flang] Fix release build flags.

Summary:
This patch removes the custom CMAKE_RELEASE_CXX_FLAGS variable.
This variable being set was having the effect of removing other important
Release flags, notably `-DNDEBUG`.

This patch may need to be accompanied by fixes for the macOS issues that
the removed comment mentions; I don't have a mac to test this on though so
hopefully a reviewer can help with that.

Reviewers: Andrzej, tskeith, sscalpone

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80794

Added: 
    

Modified: 
    flang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 886213fd3c3e..dc8de5070778 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -272,19 +272,9 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types")
   endif()
 
-  # Add to or adjust build type flags.
-  #
-  # TODO: This needs some extra thought.  CMake's default for release builds
-  # is -O3, which can cause build failures on certain platforms (and compilers)
-  # with the current code base -- some templated functions are inlined and don't
-  # become available at link time when using -O3 (with Clang under MacOS/darwin).
-  # If we reset CMake's default flags we also clobber any user provided settings;
-  # make it 
diff icult to customize a build in this regard...   The setup below
-  # has this side effect but enables successful builds across multiple platforms
-  # in release mode...
+  # Add to build type flags.
   set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGF18")
-  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DCHECK=\"(void)\"")  # do we need -O2 here?
-  set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DCHECK=\"(void)\"")
 
   # Building shared libraries is bad for performance with GCC by default
   # due to the need to preserve the right to override external entry points


        


More information about the flang-commits mailing list