Commit 966661c8 authored by Sergei Golubchik's avatar Sergei Golubchik

to simpliy and unify the code

parent 44fec70b
...@@ -568,44 +568,34 @@ int __void__; ...@@ -568,44 +568,34 @@ int __void__;
#endif /* DONT_DEFINE_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 Enabled by default for g++ due to the bug referenced below.
without generating code. We can't do this with C++
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/ */
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
#if defined(FORCE_INIT_OF_VARS) (defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0 #define LINT_INIT(var) var= 0
#if defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else #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) #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
#endif /* FORCE_INIT_OF_VARS */
#include <my_valgrind.h>
/* /*
The following is to force some unitialized variables to 0 if we are Suppress uninitialized variable warning without generating code.
running valgrind. This is needed when the compiler may access the variable
even if the value of it is never used. 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) #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
#define VALGRIND_OR_LINT_INIT(var) var=0 defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else #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 #endif
#include <my_valgrind.h>
/* Define some useful general macros */ /* Define some useful general macros */
#if !defined(max) #if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
...@@ -621,7 +611,7 @@ typedef unsigned short ushort; ...@@ -621,7 +611,7 @@ typedef unsigned short ushort;
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) #define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) #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 test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(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) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
......
...@@ -288,11 +288,6 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, ...@@ -288,11 +288,6 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
CHARSET_INFO *cs= &my_charset_bin; CHARSET_INFO *cs= &my_charset_bin;
DBUG_ENTER("extract_date_time"); 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) if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time)); bzero((char*) l_time, sizeof(*l_time));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment