Skip to content

Commit

Permalink
rbtree: introduce new ifdef condition HAVE_STATEMENT_EXPRESSION_EXT
Browse files Browse the repository at this point in the history
This one is true is the compiler supports `({...})'.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Apr 3, 2020
1 parent 2c2473a commit 1293d03
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ AH_TEMPLATE([L_tmpnam],
AH_TEMPLATE([HAVE_STAT_ST_INO],
[Define this macro if the field "st_ino" exists in struct stat in
<sys/stat.h>.])
AH_TEMPLATE([HAVE_STATEMENT_EXPRESSION_EXT],
[Define this macro if compiler supports statement expression non-standard
C feature.])
AH_TEMPLATE([remove],
[Define remove to unlink if you have unlink(), but not remove().])
AH_TEMPLATE([INT_MAX],
Expand Down Expand Up @@ -435,6 +438,16 @@ case "$host" in
esac
AM_CONDITIONAL([HOST_MINGW], [test "x${host_mingw}" = "xyes"])

AC_MSG_CHECKING(if compiler supprots statement expressions)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[
int main(int argc, char **argv) {return ({ int x = 1; x + argc;});}
])],[have_statment_expression_ext=yes],[have_statment_expression_ext=no])
AC_MSG_RESULT($have_statment_expression_ext)
if test yes = "$have_statment_expression_ext"; then
AC_DEFINE(HAVE_STATEMENT_EXPRESSION_EXT)
fi


# Check if struct stat contains st_ino.
# MinGW has st_ino, but it doesn't work.
if test yes != "$host_mingw"; then
Expand Down

0 comments on commit 1293d03

Please sign in to comment.