Hi Jim, > I noticed that the latest from gnulib's tests gets some new warnings > when compiled on Fedora 15: > > test-fread.c: In function 'main': > test-fread.c:43:3: error: implicit declaration of function > 'gl_msvc_inval_ensure_handler' [-Werror=implicit-function-declaration]
Oops, yes, I made a mistake. Fixed below. > Wouldn't it be better to make the commonly-used-in-application-code > gl_msvc_inval_ensure_handler (); > a no-op when possible, so that applications don't need to guard > uses of it with #if directives like those above? This would make sense for the cases !HAVE_MSVC_INVALID_PARAMETER_HANDLER HAVE_MSVC_INVALID_PARAMETER_HANDLER && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING But in the case HAVE_MSVC_INVALID_PARAMETER_HANDLER && MSVC_INVALID_PARAMETER_HANDLING == HAIRY_LIBRARY_HANDLING the handler exists but has, on its own, not the desired effect. Therefore I think it's better to be clear about which conditions do benefit from the code. 2011-09-28 Bruno Haible <br...@clisp.org> fgetc, fputc, fread, fwrite tests: Fix link error. * tests/test-fgetc.c (main): Don't invoke gl_msvc_inval_ensure_handler on non-MSVC platforms. * tests/test-fputc.c (main): Likewise. * tests/test-fread.c (main): Likewise. * tests/test-fwrite.c (main): Likewise. Reported by Jim Meyering. --- tests/test-fgetc.c.orig Wed Sep 28 10:22:49 2011 +++ tests/test-fgetc.c Wed Sep 28 10:22:30 2011 @@ -35,9 +35,10 @@ { const char *filename = "test-fgetc.txt"; - /* We don't have an fread() function that installs an invalid parameter + /* We don't have an fgetc() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ -#if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif --- tests/test-fputc.c.orig Wed Sep 28 10:22:49 2011 +++ tests/test-fputc.c Wed Sep 28 10:22:29 2011 @@ -37,7 +37,8 @@ /* We don't have an fputc() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ -#if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif --- tests/test-fread.c.orig Wed Sep 28 10:22:49 2011 +++ tests/test-fread.c Wed Sep 28 10:22:28 2011 @@ -37,7 +37,8 @@ /* We don't have an fread() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ -#if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif --- tests/test-fwrite.c.orig Wed Sep 28 10:22:49 2011 +++ tests/test-fwrite.c Wed Sep 28 10:22:27 2011 @@ -37,7 +37,8 @@ /* We don't have an fwrite() function that installs an invalid parameter handler so far. So install that handler here, explicitly. */ -#if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING gl_msvc_inval_ensure_handler (); #endif