This is the mail archive of the gcc@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]
Other format: [Raw text]

weird logic about redeclaring builtins...


Given the logic in c/c-decl.c's diagnose_mismatched_decls, if a
built-in function is *also* declared in a system header (which is
common with newlib), gcc fails to mention either the builtin or the
declaration if you redeclare the function as something else.

I.e. this code:

	int foo();
	int foo;

gives the expected "previous declaration was at ..." error, and this
code:

	int index;

gives the expected "built-in function 'index' declared ..." error.
However, this code:

	char *index(const char *,int);
	int index;

gives neither the built-in error nor the previous-decl error.  It
*only* gives the "'index' was redeclared" error.

Is this intentional?  Is there an easy fix for this that works for all
cases?


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