summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 5c07aa00b32..0b5458215c6 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -464,6 +464,19 @@ int __void__;
#define PURIFY_OR_LINT_INIT(var)
#endif
+/*
+ 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
+#define UNINIT_VAR(x) x= x
+#endif
+
/* Define some useful general macros */
#if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b))