And, of course, I totally screwed up the check — it should have been !=, rather than = in the check. I take solace in the fact that this is not the worst code I’ve written. :-) — Pavan On Feb 27, 2014, at 1:32 PM, Dave Goodell (dgoodell) <[email protected]> wrote:
I saw this fly by and a bug caught the corner of my eye (see inline)
Begin forwarded message:
From: Service Account <[email protected]> Subject: [mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1-22-gde80ec8 Date: February 27, 2014 11:27:24 AM PST To: <[email protected]>, <[email protected]> Reply-To: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "MPICH primary repository".
The branch, master has been updated via de80ec8704071f3b9c810509fb8acee345865902 (commit) from 956047a2696bdfb51d66f56d0b226df8d40ebd80 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://git.mpich.org/mpich.git/commitdiff/de80ec8704071f3b9c810509fb8acee345...
commit de80ec8704071f3b9c810509fb8acee345865902 Author: Pavan Balaji <[email protected]> Date: Wed Feb 26 11:49:46 2014 -0600
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 [email protected] 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.
Fixes #2047.
Signed-off-by: Huiwei Lu <[email protected]>
diff --git a/confdb/aclocal_cc.m4 b/confdb/aclocal_cc.m4 index f73aa4c..2612e94 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 <stdio.h> #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 <stdio.h> + #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
This is bad shell code. You probably want "elif test" instead.
-Dave
+ 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.
-----------------------------------------------------------------------
Summary of changes: confdb/aclocal_cc.m4 | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)
hooks/post-receive -- MPICH primary repository