diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-01-18 01:51:13 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-01-18 01:51:13 +0200 |
commit | 1757dd9f6e0211bec29c4ce0fb498dde6aa78e7e (patch) | |
tree | da2b3de26f0fb50c6b12fa3105efc703730ec26b /m4 | |
parent | 63ca340820cda8d2f7e7004f75f0e7c38c5beea3 (diff) |
use gcc statement expressions to inline commonly used functions
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_c_statement_expressions.m4 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/m4/ax_c_statement_expressions.m4 b/m4/ax_c_statement_expressions.m4 new file mode 100644 index 0000000000..fb259e7275 --- /dev/null +++ b/m4/ax_c_statement_expressions.m4 @@ -0,0 +1,23 @@ +# AC_C_STMT_EXPR +# ------------- +# Define HAVE_STMT_EXPR if compiler has statement expressions. +AN_IDENTIFIER([_Generic], [AC_C_STMT_EXPR]) +AC_DEFUN([AC_C_STMT_EXPR], +[AC_CACHE_CHECK([for statement expressions], ac_cv_c_stmt_expr, +[AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[int + main (int argc, char **argv) + { + int x = ({ int y = 1; y; }); + return x; + } + ]])], + [ac_cv_c_stmt_expr=yes], + [ac_cv_c_stmt_expr=no])]) +if test $ac_cv_c_stmt_expr = yes; then + AC_DEFINE([HAVE_STMT_EXPR], 1, + [Define to 1 if compiler supports statement expressions.]) +fi +])# AC_C_STMT_EXPR + |