On Mon, Dec 12, 2016 at 5:58 PM, Bruno Haible <br...@clisp.org> wrote:
> Hi Jim,
>
> On Windows with MSVC, the 'fpending' module does not pass its test,
> because config.h defines
>
>   #define PENDING_OUTPUT_N_BYTES 1
>
> In order to get this right, the expression should be
>
>   ((struct { unsigned char *_ptr; unsigned char *_base; } *) fp)->_ptr - 
> ((struct { unsigned char *_ptr; unsigned char *_base; } *) fp)->_base
>
> But this is code duplication (with stdio-impl.h) and produces compiler 
> warnings
> ("warning C4116: unnamed type definition in parentheses").
>
> I would therefore propose to convert the 'fpending' module to the same
> form as the other stdioext modules, with code that uses stdio-impl.h.
> Yes, this replaces some autoconfiguration by #ifs. But porting to future
> platforms is not that frequent, because hardly anyone creates freshly new 
> stdio
> implementations nowadays, and not that hard, because fseeko.c gives some 
> hints.
>
> Here's the proposed patch. It drops the 'old glibc iostream' case, which
> I haven't encountered in 8 years. But it works on MSVC.
>
>
> 2016-12-12  Bruno Haible  <br...@clisp.org>
>
>         fpending: Port to native Windows with MSVC.
>         * lib/fpending.c: Include stdio-impl.h.
>         (__fpending): Include all known implementations. Err out if it's not
>         ported.
>         * m4/fpending.m4 (gl_PREREQ_FPENDING): Remove macro.
>         * modules/fpending (Files): Add lib/stdio-impl.h.
>         (configure.ac): Don't invoke gl_PREREQ_FPENDING.

Hi Bruno,
That sounds good, and your patch looks fine.
Thanks for taking that on.

Reply via email to