Unified · Split
| @@ -542,9 +542,9 @@ static void error1(int mode, const char *fmt, va_list ap) · 541 unmodified lines | ||
| 542 | 542 | tcc_exit_state(); |
| 543 | 543 | |
| 544 | 544 | if (mode == ERROR_WARN) { |
| 545 | − if (s1->warn_none) | |
| 545 | + if (s1->warn_mask & WARN_DISABLED) | |
| 546 | 546 | return; |
| 547 | − if (s1->warn_mask & (WARN_ERROR << WARN_ERROR_SHIFT)) | |
| 547 | + if (s1->warn_mask & WARN_ERROR_MASK) /* XXX individual ignorance */ | |
| 548 | 548 | mode = ERROR_ERROR; |
| 549 | 549 | } |
| 550 | 550 | |
| @@ -1976,12 +1976,12 @@ reparse: · 1425 unmodified lines | ||
| 1976 | 1976 | } |
| 1977 | 1977 | break; |
| 1978 | 1978 | case TCC_OPTION_W: |
| 1979 | − s->warn_none = 0; | |
| 1979 | + s->warn_mask &= ~WARN_DISABLED; | |
| 1980 | 1980 | if (optarg[0] && set_W_flag(s, optarg) < 0) |
| 1981 | 1981 | goto unsupported_option; |
| 1982 | 1982 | break; |
| 1983 | 1983 | case TCC_OPTION_w: |
| 1984 | − s->warn_none = 1; | |
| 1984 | + s->warn_mask |= WARN_DISABLED; | |
| 1985 | 1985 | break; |
| 1986 | 1986 | case TCC_OPTION_rdynamic: |
| 1987 | 1987 | s->rdynamic = 1; |
| @@ -36,7 +36,7 @@ static const char help[] = · 35 unmodified lines | ||
| 36 | 36 | " -std=c99 Conform to the ISO 1999 C standard (default).\n" |
| 37 | 37 | " -std=c11 Conform to the ISO 2011 C standard.\n" |
| 38 | 38 | " -Wwarning set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n" |
| 39 | − " -w disable all warnings\n" | |
| 39 | + " -w disable all warnings and their consequences\n" | |
| 40 | 40 | " --version -v show version\n" |
| 41 | 41 | " -vv show search paths or loaded files\n" |
| 42 | 42 | " -h -hh show this, show more help\n" |
| @@ -101,12 +101,12 @@ static const char help2[] = · 58 unmodified lines | ||
| 101 | 101 | " -dt with -run/-E: auto-define 'test_...' macros\n" |
| 102 | 102 | "Ignored options:\n" |
| 103 | 103 | " --param -pedantic -pipe -s -traditional\n" |
| 104 | − "-W... warnings:\n" | |
| 104 | + "-W[no-]... warnings:\n" | |
| 105 | 105 | " all turn on some (*) warnings\n" |
| 106 | − " error stop after first warning\n" | |
| 107 | − " unsupported warn about ignored options, pragmas, etc.\n" | |
| 108 | − " write-strings strings are const\n" | |
| 109 | − " implicit-function-declaration warn for missing prototype (*)\n" | |
| 106 | + " error[=(X)] error out after first warning (for X)\n" | |
| 107 | + " unsupported warn for ignored options, pragmas,.. (X)\n" | |
| 108 | + " write-strings strings are const (*,X)\n" | |
| 109 | + " implicit-function-declaration warn for missing prototype (*,X)\n" | |
| 110 | 110 | "-f[no-]... flags:\n" |
| 111 | 111 | " unsigned-char default char is unsigned\n" |
| 112 | 112 | " signed-char default char is signed\n" |
| @@ -744,10 +744,16 @@ enum warn_option { · 743 unmodified lines | ||
| 744 | 744 | WARN_GCC_COMPAT = 1u<<1, |
| 745 | 745 | WARN_WRITE_STRINGS = 1u<<2, |
| 746 | 746 | WARN_IMPLICIT_FUNCTION_DECLARATION = 1u<<3, |
| 747 | − WARN_ERROR = 1u<<4, /* Not really as such in warn area, here only "MAX" */ | |
| 748 | − WARN_ALL = WARN_ERROR - 1 | |
| 747 | + /* _ERROR is in lower as "max", there is no warning for it */ | |
| 748 | + WARN_ERROR = 1u<<4, | |
| 749 | + WARN_ALL = WARN_ERROR - 1, | |
| 750 | + /* Is neither in lower nor upper: disables warnings and errors (-w) */ | |
| 751 | + WARN_DISABLED = WARN_ERROR << 1 | |
| 752 | +}; | |
| 753 | +enum { | |
| 754 | + WARN_ERROR_SHIFT = 16u, | |
| 755 | + WARN_ERROR_MASK = (WARN_ALL | WARN_ERROR) << WARN_ERROR_SHIFT | |
| 749 | 756 | }; |
| 750 | −enum {WARN_ERROR_SHIFT = 16u}; | |
| 751 | 757 | |
| 752 | 758 | struct TCCState { |
| 753 | 759 | unsigned char verbose; /* if true, display some information during compilation */ |
| @@ -779,7 +785,6 @@ struct TCCState { · 25 unmodified lines | ||
| 779 | 785 | unsigned char dollars_in_identifiers; /* allows '$' char in identifiers */ |
| 780 | 786 | unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */ |
| 781 | 787 | |
| 782 | − unsigned char warn_none; | |
| 783 | 788 | /* NEED_WARNING(SELF,X) used to drive W[[no-]error]=X */ |
| 784 | 789 | uint32_t warn_mask; |
| 785 | 790 | #define NEED_WARNING(SELF,SWITCH) \ |