summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-08-26 14:57:09 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-08-26 14:57:09 +0400
commitbb11eb82d5dce664e151519577df173acb31ee91 (patch)
tree94ed07b9d05778d62c9f2505ebcbbcaa62f86bb4
parent378878e1e929982a829aba27470e4b153cf7970b (diff)
downloadmariadb-git-bb11eb82d5dce664e151519577df173acb31ee91.tar.gz
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
-rw-r--r--configure.cmake2
-rw-r--r--include/my_global.h12
2 files changed, 6 insertions, 8 deletions
diff --git a/configure.cmake b/configure.cmake
index 7ec87f6e9a8..4adc977b192 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -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")
diff --git a/include/my_global.h b/include/my_global.h
index e9a472e686e..bec5fb027eb 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -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)