[PATCH] tighten up -Wbuiltin-declaration-mismatch (PR 86125)
Joseph Myers
joseph@codesourcery.com
Thu Jun 14 20:37:00 GMT 2018
On Thu, 14 Jun 2018, Martin Sebor wrote:
> Hmm, I thought fileptr_type_node was a node for FILE*, but it's
> actually the same as ptr_type_node, i.e., void*, so the built-in
> fprintf expects a void* argument (and declaring it to take a FILE*
> triggers the new warning). That seems odd. What purpose does it
> serve? (AFAICS, it's not used anywhere except jit).
>
> I would expect fileptr_type_node to be set to correspond to
> FILE* once FILE is declared. Why is that not done?
The built-in functions (which use fileptr_type_node via BT_FILEPTR in
builtin-types.def) are defined long before any definition of FILE is
known. FILE may be a macro not just a typedef, and the user is free to
have an unrelated definition of FILE if they don't include <stdio.h> or
another standard header defining FILE in that translation unit.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list