This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR bootstrap/42798


* Paolo Bonzini wrote on Fri, Jun 04, 2010 at 05:04:15PM CEST:
> On 06/04/2010 04:59 PM, Ian Lance Taylor wrote:
> >With regard to the gold change.  What will happen if the system header
> >files provide only a declaration
> >     char *basename(const char *)
> >?
> 
> I think it works, because C casts are allowed to do anything they
> want to constness.

Well, the respective configure test for
  AC_CHECK_DECL([basename(char*)])

in C++ mode tries to compile something like
  (void) basename ((char*) 0);

it doesn't try to ensure that the declaration is the same as the one
you're using.  So in fact not using 'const' is safer that using it.
Hmm, maybe the Autoconf manual should be clearer about this.  Anyway,
this method only works for argument types for which a cast of 0 makes
sense.

Cheers,
Ralf


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