win32: warn people about using undeclared WINAPI functions

*** UNCONDITIONALLY ***

Esp. sihce tinycc winapi headers are not as complete as people might
expect this can otherwise lead to obscure problems that are difficult
to debug.

(Originally 'warn_implicit_function_declaration' was set to 1
always for windows but someone must have deleted that line)
master
grischka 2014-04-06 10:59:40 +02:00
parent 6a947d9d26
commit 0e43f3aef4
1 changed files with 10 additions and 4 deletions

View File

@ -3901,13 +3901,19 @@ ST_FUNC void unary(void)
expect("identifier");
s = sym_find(t);
if (!s) {
const char *name = get_tok_str(t, NULL);
if (tok != '(')
tcc_error("'%s' undeclared", get_tok_str(t, NULL));
tcc_error("'%s' undeclared", name);
/* for simple function calls, we tolerate undeclared
external reference to int() function */
if (tcc_state->warn_implicit_function_declaration)
tcc_warning("implicit declaration of function '%s'",
get_tok_str(t, NULL));
if (tcc_state->warn_implicit_function_declaration
#ifdef TCC_TARGET_PE
/* people must be warned about using undeclared WINAPI functions
(which usually start with uppercase letter) */
|| (name[0] >= 'A' && name[0] <= 'Z')
#endif
)
tcc_warning("implicit declaration of function '%s'", name);
s = external_global_sym(t, &func_old_type, 0);
}
if ((s->type.t & (VT_STATIC | VT_INLINE | VT_BTYPE)) ==