report the line of the previous declaration of the function

This commit is contained in:
Bill Currie 2007-04-06 12:02:34 +00:00 committed by Jeff Teunissen
parent a6388ee680
commit f6924f35e5
2 changed files with 8 additions and 1 deletions

View file

@ -40,6 +40,8 @@ typedef struct overloaded_function_s {
const char *full_name;
struct type_s *type;
int overloaded;
string_t file;
int line;
} overloaded_function_t;
typedef struct function_s {

View file

@ -184,9 +184,12 @@ get_function (const char *name, type_t *type, int overload, int create)
func = Hash_Find (function_map, name);
if (func) {
if (!overload && !func->overloaded) {
expr_t *e = new_expr ();
e->line = func->line;
e->file = func->file;
warning (0, "creating overloaded function %s without @overload",
full_name);
warning (0, "(previous function is %s)",
warning (e, "(previous function is %s)",
func->full_name);
}
overload = 1;
@ -197,6 +200,8 @@ get_function (const char *name, type_t *type, int overload, int create)
func->full_name = full_name;
func->type = type;
func->overloaded = overload;
func->file = pr.source_file;
func->line = pr.source_line;
Hash_Add (overloaded_functions, func);
Hash_Add (function_map, func);