[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: msvc-inval: more options
From: |
Jim Meyering |
Subject: |
Re: msvc-inval: more options |
Date: |
Wed, 28 Sep 2011 11:15:11 +0200 |
Bruno Haible wrote:
>> 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 <address@hidden>
>
> 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.
Hi Bruno,
Thank you for the quick fix.
With that, coreutils-updated-to-use-latest-from-gnulib
now passes its build/check tests on Fedora 15 and rawhide.
> --- 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
That is a detail specific to MSVC. Why impose the readability and
maintenance hassle of requiring such an expression on all callers?
Wouldn't you prefer to make any MSVC-related code as inconspicuous
as possible? Not to mention avoiding the duplication of an #if
expression like that...
Re: msvc-inval: more options, Bruno Haible, 2011/09/27