From c5ce5eaedae46467f6e538e4e5b25910b863de75 Mon Sep 17 00:00:00 2001 From: bellard Date: Sat, 4 Oct 2003 13:04:47 +0000 Subject: [PATCH] fixed -w option - doc update (thanx to Romain Francoise) --- tcc-doc.texi | 11 +++++++++-- tcc.c | 18 ++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tcc-doc.texi b/tcc-doc.texi index df36984..1396fb0 100644 --- a/tcc-doc.texi +++ b/tcc-doc.texi @@ -181,7 +181,14 @@ Undefine preprocessor symbol @samp{sym}. Warning options: -Note: each warning option has a negative form beginning with @option{-Wno-}. +@table @option +@item -w +Disable all warnings. + +@end table + +Note: each of the following warning options has a negative form beginning with +@option{-Wno-}. @table @option @item -Wunsupported @@ -604,7 +611,7 @@ executable ELF files and dynamic ELF libraries without relying on an external linker. Dynamic ELF libraries can be output but the C compiler does not generate -position independent code (PIC). It means that the dynamic librairy +position independent code (PIC). It means that the dynamic library code generated by TCC cannot be factorized among processes yet. TCC linker eliminates unreferenced object code in libraries. A single pass is diff --git a/tcc.c b/tcc.c index 5a7673b..3195802 100644 --- a/tcc.c +++ b/tcc.c @@ -408,7 +408,8 @@ struct TCCState { int warn_write_strings; int warn_unsupported; int warn_error; - + int warn_none; + /* error handling */ void *error_opaque; void (*error_func)(void *opaque, const char *msg); @@ -1238,6 +1239,9 @@ void warning(const char *fmt, ...) TCCState *s1 = tcc_state; va_list ap; + if (s1->warn_none) + return; + va_start(ap, fmt); error1(s1, 1, fmt, ap); va_end(ap); @@ -9551,16 +9555,6 @@ int tcc_set_warning(TCCState *s, const char *warning_name, int value) #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) { @@ -9872,7 +9866,7 @@ int main(int argc, char **argv) } break; case TCC_OPTION_w: - tcc_reset_warnings(s); + s->warn_none = 1; break; case TCC_OPTION_rdynamic: s->rdynamic = 1;