This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [geoffk@cygnus.com: GCC testing failed with your patch.]


I've cc'ed some of the folks I thought might have some insight into
the C++ language and our implementation of it.  This message deals
with new builtin decls for bzero/bcmp WRT causing some C++ testsuite
regressions.  Sorry to impose on you, and sorry if I omitted anyone
considered a guru who is now offended I didn't include them. :-)



 > From: Alan Modra <alan@linuxcare.com.au>
 > 
 > On Fri, 24 Mar 2000, Geoff Keating wrote:
 > 
 > > /thief/plunder/objs/H-i686-pc-linux-gnu/powerpc-eabisim/include/string.h:55: war
 > > ning: new declaration `int bcmp (const char *, const char *, unsigned int)'
 > > /thief/plunder/objs/H-i686-pc-linux-gnu/powerpc-eabisim/include/string.h:55: war
 > > ning: ambiguates built-in declaration `int bcmp (const void *, const void *, uns
 > > igned int)'
 > > 
 > > I think you didn't mean 'void *'.
 > 
 > Just to add fuel to the fire, I'm quite happy with `void *', just don't
 > like `unsigned int' ;-) 
 > 
 > On i586-linuxlibc1, I get libio and libstdc++ testsuite failures due to
 > this too.  They are just warnings, but that bombs the test, which gets all
 > upset over any compiler output.
 > 
 > /usr/include/string.h:155: warning: new declaration `void bzero (void
 > /usr/include/string.h:155: warning: *, int)'
 > /usr/include/string.h:155: warning: ambiguates built-in declaration
 > /usr/include/string.h:155: warning: `void bzero (void *, unsigned int)'
 > /usr/include/string.h:158: warning: new declaration `int bcmp (const
 > /usr/include/string.h:158: warning: void *, const void *, int)'
 > /usr/include/string.h:158: warning: ambiguates built-in declaration
 > /usr/include/string.h:158: warning: `int bcmp (const void *, const void
 > /usr/include/string.h:158: warning: *, unsigned int)'

Argh.  Okay let me tell you what's going on with the internal
prototypes and maybe you can help me decide what the best thing to do
for C++.

Currently, the compiler is effectively doing the following inside
itself: (For the record, this works for me on RH-linux and solaris2.7
with no regressions, because their prototypes for bcmp/bzero do match
the builtins I wrote in C++...)

 > #ifdef __cplusplus
 > extern void __builtin_bzero (void *, size_t);
 > extern int __builtin_bcmp (const void *, const void *, size_t);
 > extern void bzero (void *, size_t);
 > extern int bcmp (const void *, const void *, size_t);
 > #else /* C or objc */
 > # ifdef __STDC__
 > extern void __builtin_bzero (void *, size_t);
 > extern int __builtin_bcmp (const void *, const void *, size_t);
 > extern void bzero ();
 > extern int bcmp ();
 > # else /* traditional C */
 > extern void __builtin_bzero (char *, int);
 > extern int __builtin_bcmp (const char *, const char *, int);
 > extern void bzero ();
 > extern int bcmp ();
 > # endif /* __STDC__ */
 > #endif /* __cplusplus */

Since no two platforms seem to agree on what the parameters for bzero
and bcmp are, for C/objc you'll note I left them blank.  This is okay
since it will merge with whatever the platform provides in its
headers.  And if the platform provides none at all, the internal
machinery still verifies that the function was passed the right types
before proceeding.

However I don't think you can do that for C++ because bcmp() means
bcmp(void).  And bcmp(...) also clashes.  It may be that we have to
simply turn this off for C++, I don't know yet.  Perhaps one of the
C++ gurus can tell me whether there is a way to do anonymous argument
prototypes (internally, if not in the language.)

Note, if we turn off builtin bcmp/bzero for C++, we can probably still
leave in __builtin_bzero/__builtin_bcmp in since it won't clash with
anything.

Also note, I prefer a solution which doesn't involve doing configure
checks to determine the parameters, since that could change at run
time depending on what macros are defined in each user's compiler
invocation run.

Comments/suggestions welcome.

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]