added -w option

This commit is contained in:
bellard 2003-09-19 20:35:50 +00:00
parent f8d0241764
commit 9c1106d854

17
tcc.c
View file

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