[Openmp-commits] [PATCH] D55952: [libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.

Michael Kruse via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Mar 24 13:28:07 PDT 2019


Meinersbur marked an inline comment as done.
Meinersbur added inline comments.


================
Comment at: libomptarget/CMakeLists.txt:48-49
   add_definitions(-DOMPTARGET_DEBUG)
-  add_definitions(-g)
-  add_definitions(-O0)
 endif()
----------------
grokos wrote:
> Why are these lines removed? When building in debug mode we need to have debug symbols (-g) and prevent the compiler from optimizing things away (-O0) in order to be able to use a debugger correctly.
This is mentioned in the summary.

> This patch also remove adding -g -O0 in debug builds, it should be handled by cmake.

With `CMAKE_BUILD_TYPE=Debug`, CMake will add `CMAKE_{C|CXX}_FLAGS_DEBUG` to `CMAKE_{C|CXX}_FLAGS`.  `CMAKE_{C|CXX}_FLAGS_DEBUG` is preinitialized with the compiler's debug options, e.g. `-O0 -g` for gcc. Adding these flags using `add_definitions` is either redundant, might result in an error for non-gcc-like command line interfaces, or clashes with user-provided debug flags (such as `cmake -DCMAKE_C_FLAGS_DEBUG="-gdwarf=5 -Og"`).

Unless I am overseeing something, in which case please point me to it.


Repository:
  rOMP OpenMP

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55952/new/

https://reviews.llvm.org/D55952





More information about the Openmp-commits mailing list