Skip to content

Commit

Permalink
MDEV-6305 - UNINIT_VAR emits code in non-debug builds
Browse files Browse the repository at this point in the history
Reverted workaround for gcc bug, which was fixed 3 years ago:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772
  • Loading branch information
svoj committed Aug 26, 2014
1 parent 378878e commit bb11eb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ENDIF()

# Always enable -Wall for gnu C/C++
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter -Wno-init-self")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall")
Expand Down
12 changes: 5 additions & 7 deletions include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,16 +480,14 @@ extern "C" int madvise(void *addr, size_t len, int behav);

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

#if !defined(HAVE_UINT)
Expand Down

0 comments on commit bb11eb8

Please sign in to comment.