1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix compiler error if compiler does not support c99 style

initializers.
This commit is contained in:
Jan Lindström
2015-05-07 14:00:14 +03:00
parent 7ed673f35c
commit 3832bda1ba
5 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,4 @@
--source include/not_embedded.inc
select * from information_schema.innodb_trx;
select * from information_schema.innodb_locks;

View File

@ -210,6 +210,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC)
ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1)
ENDIF()
CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS)
ENDIF(NOT MSVC)
CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)

View File

@ -85,10 +85,13 @@ do { \
} \
} while (0)
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
!defined __INTEL_COMPILER && !defined __clang__
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__
#ifdef HAVE_C99_INITIALIZERS
#define STRUCT_FLD(name, value) .name = value
#else
#define STRUCT_FLD(name, value) name: value
#endif /* HAVE_C99_INITIALIZERS */
#else
#define STRUCT_FLD(name, value) value
#endif

View File

@ -219,6 +219,8 @@ IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC)
ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1)
ENDIF()
CHECK_C_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS)
ENDIF(NOT MSVC)
CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)

View File

@ -89,10 +89,13 @@ do { \
} \
} while (0)
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
!defined __INTEL_COMPILER && !defined __clang__
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER && !defined __clang__
#ifdef HAVE_C99_INITIALIZERS
#define STRUCT_FLD(name, value) .name = value
#else
#define STRUCT_FLD(name, value) name: value
#endif /* HAVE_C99_INITIALIZERS */
#else
#define STRUCT_FLD(name, value) value
#endif