From d6381f1f060244fda0a6dda31c3aec8cfc50980e Mon Sep 17 00:00:00 2001 From: Pavan Balaji Date: Wed, 26 Feb 2014 11:49:46 -0600 Subject: [PATCH] Better checks for VA_ARGS. We were disabling VA_ARGS whenever the compiler throws warnings. However, in some cases, the compiler is throwing warnings in general (because of bad user-specified flags) and not specifically because of VA_ARGS. See discussion on the discuss@mpich.org mailing list: http://lists.mpich.org/pipermail/discuss/2014-February/002246.html This patch works around this issue by checking the difference in the warning flags with and without VA_ARGS. No reviewer. --- confdb/aclocal_cc.m4 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/confdb/aclocal_cc.m4 b/confdb/aclocal_cc.m4 index f73aa4cb..2612e94d 100644 --- a/confdb/aclocal_cc.m4 +++ b/confdb/aclocal_cc.m4 @@ -1644,22 +1644,35 @@ AC_DEFUN([PAC_C_MACRO_VA_ARGS],[ AC_MSG_CHECKING([for variable argument list macro functionality]) # check if the program links correctly - rm -f pac_test.log - PAC_LINK_IFELSE_LOG([pac_test.log],[AC_LANG_PROGRAM([ + rm -f pac_test1.log pac_test2.log + + PAC_LINK_IFELSE_LOG([pac_test1.log],[AC_LANG_PROGRAM([ #include #define conftest_va_arg_macro(...) printf(__VA_ARGS__) ], [conftest_va_arg_macro("a test %d", 3);])], prog_links=yes,prog_links=no) + PAC_LINK_IFELSE_LOG([pac_test2.log],[AC_LANG_PROGRAM([ + #include + #define conftest_va_arg_macro printf + ], + [conftest_va_arg_macro("a test %d", 3);])]) + # If the program linked OK, make sure there were no warnings - if test "$prog_links" = "yes" -a "`cat pac_test.log`" = "" ; then + if test "$prog_links" = "yes" -a "`diff pac_test1.log pac_test2.log`" = "" ; then AC_DEFINE([HAVE_MACRO_VA_ARGS],[1],[Define if C99-style variable argument list macro functionality]) AC_MSG_RESULT([yes]) + elif "`diff pac_test1.log pac_test2.log`" = "" ; then + AC_MSG_RESULT([no, compiler generates warnings]) + echo "With VA_ARGS:" + cat pac_test1.log + echo "Without VA_ARGS:" + cat pac_test2.log else AC_MSG_RESULT([no]) fi - rm -f pac_test.log + rm -f pac_test1.log pac_test2.log ])dnl # Will AC_DEFINE([HAVE_BUILTIN_EXPECT]) if the compiler supports __builtin_expect. -- 1.8.3.4 (Apple Git-47)