[Commits] Rev 2930: to simpliy and unify the code in http://bazaar.launchpad.net/~maria-captains/maria/5.1/

serg at askmonty.org serg at askmonty.org
Sat Sep 11 10:46:36 EEST 2010


At http://bazaar.launchpad.net/~maria-captains/maria/5.1/

------------------------------------------------------------
revno: 2930
revision-id: sergii at pisem.net-20100911074633-72ruu8h1chonk4ub
parent: sergii at pisem.net-20100909133547-cdot6armywvo35ax
committer: Sergei Golubchik <sergii at pisem.net>
branch nick: 5.1
timestamp: Sat 2010-09-11 09:46:33 +0200
message:
  to simpliy and unify the code
-------------- next part --------------
=== modified file 'include/my_global.h'
--- a/include/my_global.h	2010-08-27 14:12:44 +0000
+++ b/include/my_global.h	2010-09-11 07:46:33 +0000
@@ -568,44 +568,34 @@ int	__void__;
 #endif /* DONT_DEFINE_VOID */
 
 /*
-  Try to suppress warning for not initialized variables.
+  Deprecated workaround for false-positive uninitialized variables
+  warnings. Those should be silenced using tool-specific heuristics.
 
-  With gcc when using C, we suppress the uninitialized variable warning
-  without generating code. We can't do this with C++
-  for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+  Enabled by default for g++ due to the bug referenced below.
 */
-
-#if defined(FORCE_INIT_OF_VARS)
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+    (defined(__GNUC__) && defined(__cplusplus))
 #define LINT_INIT(var) var= 0
-#if defined(__cplusplus) || !defined(__GNUC__)
-#define UNINIT_VAR(x) x= 0
 #else
-/* GCC specific self-initialization which inhibits the warning. */
-#define UNINIT_VAR(x) x= x
-#endif
-#else /* !FORCE_INIT_OF_VARS */
 #define LINT_INIT(var)
-#if !defined(__cplusplus) && !defined(__GNUC__)
-/* GCC specific self-initialization which inhibits the warning. */
-#define UNINIT_VAR(x) x= x
-#else
-#define UNINIT_VAR(x) x
 #endif
-#endif /* FORCE_INIT_OF_VARS */
-
-#include <my_valgrind.h>
 
 /*
-  The following is to force some unitialized variables to 0 if we are
-  running valgrind. This is needed when the compiler may access the variable
-  even if the value of it is never used.
+   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(HAVE_valgrind)
-#define VALGRIND_OR_LINT_INIT(var) var=0
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+    defined(__cplusplus) || !defined(__GNUC__)
+#define UNINIT_VAR(x) x= 0
 #else
-#define VALGRIND_OR_LINT_INIT(var) LINT_INIT(var)
+/* GCC specific self-initialization which inhibits the warning. */
+#define UNINIT_VAR(x) x= x
 #endif
 
+#include <my_valgrind.h>
+
 /* Define some useful general macros */
 #if !defined(max)
 #define max(a, b)       ((a) > (b) ? (a) : (b))
@@ -621,7 +611,7 @@ typedef unsigned short ushort;
 
 #define CMP_NUM(a,b)    (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
 #define sgn(a)          (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
-#define swap_variables(t, a, b) { t swap_dummy; swap_dummy= a; a= b; b= swap_dummy; }
+#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
 #define test(a)         ((a) ? 1 : 0)
 #define set_if_bigger(a,b)  do { if ((a) < (b)) (a)=(b); } while(0)
 #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2010-08-27 14:12:44 +0000
+++ b/sql/item_timefunc.cc	2010-09-11 07:46:33 +0000
@@ -288,11 +288,6 @@ static bool extract_date_time(DATE_TIME_
   CHARSET_INFO *cs= &my_charset_bin;
   DBUG_ENTER("extract_date_time");
 
-  LINT_INIT(strict_week_number);
-  /* Remove valgrind varnings when using gcc 3.3 and -O1 */
-  VALGRIND_OR_LINT_INIT(strict_week_number_year_type);
-  VALGRIND_OR_LINT_INIT(sunday_first_n_first_week_non_iso);
-
   if (!sub_pattern_end)
     bzero((char*) l_time, sizeof(*l_time));
 



More information about the commits mailing list