[Bug c/34710] FORTIFY_SOURCE matches to many patterns

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Feb 9 00:22:00 GMT 2008



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-02-09 00:21 -------
(In reply to comment #5)
> The code is not "buggy". printf and fprintf are not reserved words, and
> occupy a separate namespace with regard to the structure name and any
> global function names. 

No they can be function macros if you include stdio.h, please read the
standard.

>From C99 (7.1.4/1):
Any function declared in a header may be additionally implemented as a
function-likemacro defined in the header, so if a library function is declared
explicitly when its header is included, one 
of the techniques shown belowcan be used to ensure the declaration is not
affected by 
such a macro.


So you can do:

        p.(fprintf)(&p, "%i", 123);

or
#undef fprintf after including stdio.h.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34710



More information about the Gcc-bugs mailing list