Patch for builtin fputs (first stdio opt ready for install)

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Apr 17 09:36:00 GMT 2000


 > From: Jason Merrill <jason@cygnus.com>
 > 
 > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 > 
 > > Regarding the FILE* hackery, for now I've declared fputs without
 > > arguments.  I also figured out why this didn't work with G++ testsuite
 > > before.  The G++ testsuite uses -pedantic-errors which causes int
 > > fputs(...) to conflict with the fully qualified stdio.h definition.
 > 
 > This is the same problem I mentioned before in connection with bzero
 > et al.  Rather than disable this for g++, I would prefer to change the
 > compiler to allow both cases, as below.

Great, thanks for the fix.  I wrote you about the bzero problem you
reported and never heard back so I was wondering whether you wanted me
to do something like this for bzero/bcmp or not.  I'm glad you fixed
it in a way that allows these no-arg builtins to always work with g++.

I'll update the patch to take out the "g++ -pedantic" special case.


 > Also, the get_decl interface seems a bit limited; what if fputc is
 > only declared in the std:: namespace, for instance?  What about
 > applying similar transformations to, say, Java I/O, which is buried
 > down in a nested package?  I suppose the frontend implementation could
 > be clever about mapping from C strings to function decls, but I bet we
 > can do better.


My C++ programming days were before namespaces were common so my
understanding of them is limited.  Are you saying the std:: namespace
is different from the "global" one?  Assuming they are not the same
thing, what do relevant standards say about which namespaces fputc
must be declared?

Do you have a specific suggestion as to how I should make the
get_decl() interface more generic or useful?  I'm guessing that I
could simply add a second argument that each front end could use as it
deems fit.  E.g. g++ would interpret it as a namespace, and the C
front end would ignore it. (?)

--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


More information about the Gcc-patches mailing list