Author: cazfi Date: Wed Aug 3 00:58:43 2016 New Revision: 33428 URL: http://svn.gna.org/viewcvs/freeciv?rev=33428&view=rev Log: Added configure check about brace usage around C99 struct initializer within union.
See patch #7530 Modified: branches/S2_6/configure.ac branches/S2_6/m4/c99.m4 Modified: branches/S2_6/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/configure.ac?rev=33428&r1=33427&r2=33428&view=diff ============================================================================== --- branches/S2_6/configure.ac (original) +++ branches/S2_6/configure.ac Wed Aug 3 00:58:43 2016 @@ -665,6 +665,8 @@ AC_C99_VARIABLE_ARRAYS AC_C99_INITIALIZERS AC_C99_STDINT_H + +FC_C99_INITIALIZER_BRACES FC_C11_STATIC_ASSERT FC_C11_AT_QUICK_EXIT Modified: branches/S2_6/m4/c99.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/m4/c99.m4?rev=33428&r1=33427&r2=33428&view=diff ============================================================================== --- branches/S2_6/m4/c99.m4 (original) +++ branches/S2_6/m4/c99.m4 Wed Aug 3 00:58:43 2016 @@ -99,3 +99,40 @@ AC_MSG_ERROR([A preprocessor supporting token concenation is required]) fi ]) + +# Whether C99-style initializers of a struct can, or even must, be +# within braces. +# Sets macros INIT_BRACE_BEGIN and INIT_BRACE_END accordingly. +# +AC_DEFUN([FC_C99_INITIALIZER_BRACES], +[ +AC_CACHE_CHECK([can struct initializers be within braces], + [ac_cv_c99_initializer_braces], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [[ +struct outer +{ + int v1; + int v2; + union + { + int v3; + struct + { + int v4; + int v5; + } inner; + }; +}; + + struct outer init_me = { 1, 2, { .inner = { 3, 4 }}} +]])], + [ac_cv_c99_initializer_braces=yes], [ac_cv_c99_initializer_braces=no])]) + if test "x${ac_cv_c99_initializer_braces}" = "xyes" ; then + AC_DEFINE([INIT_BRACE_BEGIN], [{], [Beginning of C99 structure initializer]) + AC_DEFINE([INIT_BRACE_END], [}], [End of C99 structure initializer]) + else + AC_DEFINE([INIT_BRACE_BEGIN], [], [Beginning of C99 structure initializer]) + AC_DEFINE([INIT_BRACE_END], [], [End of C99 structure initializer]) + fi +]) _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits