On Feb 9, 2012, at 5:38 PM, Paul H. Hargrove wrote:

>> We then test if *either* set the variable. 
>> Sort of a double-negative.
> 
> One of De Morgan's Laws:
>    NOT (A AND B) = (NOT A) OR (NOT B)
> 
> Applied to give:
>    NOT (TEST1_FAIL AND TEST2_FAIL)
>       = (NOT TEST1_FAIL) OR (NOT TEST2_FAIL)
>       = TEST1_PASS OR TEST2_PASS

I think I mis-read your initial patch, but I think we're both agreeing on the 
actual functionality.  My definition of "pass" might well have been opposite of 
yours: I was saying that the compiler needs to be able to detect both scenarios 
(passing less than enough arguments and passing more than enough arguments).

To do that, I amended your patch to count how many of those two tests "passed". 
 If the number of passed tests was 2, all was good.  If not, fail.

This may be redundant with your original patch, but that's what I did.  :-)

Here's the final logic -- is it what you intended?

    # Make sure the compiler returns an error code when function arg
    # count is wrong, otherwise sched_setaffinity checks may fail.
    HWLOC_STRICT_ARGS_CFLAGS=
    hwloc_args_check=0
    AC_MSG_CHECKING([whether the C compiler rejects function calls with too 
many arguments])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        extern int one_arg(int x);
        int foo(void) { return one_arg(1, 2); }
      ]])],
      [AC_MSG_RESULT([no])],
      [hwloc_args_check=1
       AC_MSG_RESULT([yes])])
    AC_MSG_CHECKING([whether the C compiler rejects function calls with too few 
arguments])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        extern int two_arg(int x, int y);
        int foo(void) { return two_arg(3); }
      ]])],
      [AC_MSG_RESULT([no])],
      [hwloc_args_check=`expr $hwloc_args_check + 1`
       AC_MSG_RESULT([yes])])
    AS_IF([test "$hwloc_args_check" != "2"],[
         AC_MSG_WARN([Your C compiler does not consider incorrect argument 
counts to be a fatal error.])
        case "$hwloc_c_vendor" in
        ibm)
            HWLOC_STRICT_ARGS_CFLAGS="-qhalt=e"
            ;;
        *)
            HWLOC_STRICT_ARGS_CFLAGS=FAIL
            AC_MSG_WARN([Please report this warning and configure using a 
different C compiler if possible.])
            ;;
        esac
        AS_IF([test "$HWLOC_STRICT_ARGS_CFLAGS" != "FAIL"],[
            AC_MSG_WARN([Configure will append '$HWLOC_STRICT_ARGS_CFLAGS' to 
the value of CFLAGS when needed.])
             AC_MSG_WARN([Alternatively you may configure with a different 
compiler.])
        ])
    ])

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to