Skip to content

Commit bb11eb8

Browse files
committed
MDEV-6305 - UNINIT_VAR emits code in non-debug builds
Reverted workaround for gcc bug, which was fixed 3 years ago: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772
1 parent 378878e commit bb11eb8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

configure.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ENDIF()
5555

5656
# Always enable -Wall for gnu C/C++
5757
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*")
58-
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
58+
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter -Wno-init-self")
5959
ENDIF()
6060
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*")
6161
SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall")

include/my_global.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,14 @@ extern "C" int madvise(void *addr, size_t len, int behav);
480480

481481
/*
482482
Suppress uninitialized variable warning without generating code.
483-
484-
The _cplusplus is a temporary workaround for C++ code pending a fix
485-
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
486483
*/
487-
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
488-
defined(__cplusplus) || !defined(__GNUC__)
489-
#define UNINIT_VAR(x) x= 0
490-
#else
484+
#if defined(__GNUC__)
491485
/* GCC specific self-initialization which inhibits the warning. */
492486
#define UNINIT_VAR(x) x= x
487+
#elif defined(_lint) || defined(FORCE_INIT_OF_VARS)
488+
#define UNINIT_VAR(x) x= 0
489+
#else
490+
#define UNINIT_VAR(x) x
493491
#endif
494492

495493
#if !defined(HAVE_UINT)

0 commit comments

Comments
 (0)