added -w option

tcc-xref
bellard 2003-09-19 20:35:50 +00:00
parent f8d0241764
commit 9c1106d854
1 changed files with 16 additions and 1 deletions

17
tcc.c
View File

@ -9549,9 +9549,18 @@ int tcc_set_warning(TCCState *s, const char *warning_name, int value)
return 0;
}
#if !defined(LIBTCC)
static void tcc_reset_warnings(TCCState *s)
{
int i;
const WarningDef *p;
for(i = 0, p = warning_defs; i < countof(warning_defs); i++, p++) {
*(int *)((uint8_t *)s + p->offset) = 0;
}
}
/* extract the basename of a file */
static const char *tcc_basename(const char *name)
{
@ -9596,6 +9605,7 @@ void help(void)
" -bench output compilation statistics\n"
" -run run compiled source\n"
" -Wwarning set or reset (with 'no-' prefix) 'warning'\n"
" -w disable all warnings\n"
"Preprocessor options:\n"
" -Idir add include path 'dir'\n"
" -Dsym[=val] define 'sym' with value 'val'\n"
@ -9652,6 +9662,7 @@ enum {
TCC_OPTION_rdynamic,
TCC_OPTION_run,
TCC_OPTION_v,
TCC_OPTION_w,
};
static const TCCOption tcc_options[] = {
@ -9684,6 +9695,7 @@ static const TCCOption tcc_options[] = {
{ "nostdlib", TCC_OPTION_nostdlib, 0 },
{ "print-search-dirs", TCC_OPTION_print_search_dirs, 0 },
{ "v", TCC_OPTION_v, 0 },
{ "w", TCC_OPTION_w, 0 },
{ NULL },
};
@ -9859,6 +9871,9 @@ int main(int argc, char **argv)
goto unsupported_option;
}
break;
case TCC_OPTION_w:
tcc_reset_warnings(s);
break;
case TCC_OPTION_rdynamic:
s->rdynamic = 1;
break;