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?