From 9c1106d85411ef4691792c9b9dc612ba0a5383b1 Mon Sep 17 00:00:00 2001 From: bellard Date: Fri, 19 Sep 2003 20:35:50 +0000 Subject: [PATCH] added -w option --- tcc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tcc.c b/tcc.c index 68bf0461..5a7673b8 100644 --- a/tcc.c +++ b/tcc.c @@ -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; -- 2.11.4.GIT