8000 Enable -Og for debug builds (#14438) · RtiWeb/arangodb@8270a7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 8270a7e

Browse files
authored
Enable -Og for debug builds (arangodb#14438)
1 parent 287b9f3 commit 8270a7e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,9 @@ else () # NOT MSVC
987987
message(STATUS "Compiler type GNU: ${CMAKE_CXX_COMPILER}")
988988
set(BASE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations ${BASE_FLAGS}")
989989
set(EXTRA_CXX_FLAGS "-Wsuggest-override -Wnon-virtual-dtor")
990+
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "11.1.0")
991+
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-error=nonnull")
992+
endif()
990993
elseif (CMAKE_COMPILER_IS_CLANG)
991994
message(STATUS "Compiler type CLANG: ${CMAKE_CXX_COMPILER}")
992995
set(BASE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations ${BASE_FLAGS}")
@@ -1033,7 +1036,7 @@ else () # NOT MSVC
10331036
# CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}.
10341037
# there is no need to repeat the base flags in the build-type specific flags!
10351038
set(CMAKE_C_FLAGS "${EXTRA_C_FLAGS}" CACHE INTERNAL "default C compiler flags")
1036-
set(CMAKE_C_FLAGS_DEBUG "${DEBUGINFO_FLAGS} -O0 -D_DEBUG=1" CACHE INTERNAL "C debug flags")
1039+
set(CMAKE_C_FLAGS_DEBUG "${DEBUGINFO_FLAGS} -Og -D_DEBUG=1" CACHE INTERNAL "C debug flags")
10371040
set(CMAKE_C_FLAGS_MINSIZEREL "${NODEBUGINFO_FLAGS} -Os" CACHE INTERNAL "C minimal size flags")
10381041
set(CMAKE_C_FLAGS_RELEASE "${NODEBUGINFO_FLAGS} -O3 -fomit-frame-pointer" CACHE INTERNAL "C release flags")
10391042
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${DEBUGINFO_FLAGS} -O3 -fno-omit-frame-pointer" CACHE INTERNAL "C release with debug info flags")
@@ -1044,7 +1047,7 @@ else () # NOT MSVC
10441047
# CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}.
10451048
# there is no need to repeat the base flags in the build-type specific flags!
10461049
set(CMAKE_CXX_FLAGS "${EXTRA_CXX_FLAGS}" CACHE INTERNAL "default C++ compiler flags")
1047-
set(CMAKE_CXX_FLAGS_DEBUG "${DEBUGINFO_FLAGS} -O0 -D_DEBUG=1" CACHE INTERNAL "C++ debug flags")
1050+
set(CMAKE_CXX_FLAGS_DEBUG "${DEBUGINFO_FLAGS} -Og -D_DEBUG=1" CACHE INTERNAL "C++ debug flags")
10481051
set(CMAKE_CXX_FLAGS_MINSIZEREL "${NODEBUGINFO_FLAGS} -Os" CACHE INTERNAL "C++ minimal size flags")
10491052
set(CMAKE_CXX_FLAGS_RELEASE "${NODEBUGINFO_FLAGS} -O3 -fomit-frame-pointer" CACHE INTERNAL "C++ release flags")
10501053
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${DEBUGINFO_FLAGS} -O3 -fno-omit-frame-pointer" CACHE INTERNAL "C++ release with debug info flags")

lib/Basics/ResultT.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#include "Basics/debugging.h"
3333
#include "Basics/voc-errors.h"
3434

35+
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 11)
36+
#pragma GCC diagnostic push
37+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
38+
#endif
39+
3540
namespace arangodb {
3641

3742
// @brief Extension of Result which, on success, contains a value of type T.
@@ -263,3 +268,6 @@ class ResultT {
263268

264269
} // namespace arangodb
265270

271+
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 11)
272+
#pragma GCC diagnostic pop
273+
#endif

0 commit comments

Comments
 (0)
0