History

-W[no-]error: rid of TCCState.warn_none, too; and adjust -h/-hh output

Steffen Nurpmeso committed 5 years ago

Commit 49cd6f51 parent 0d59ac43 files · +19 −14Browse files

Unified · Split

3 files
  1. libtcc.c +4 −4
  2. tcc.c +6 −6
  3. tcc.h +9 −4
libtcc.c+4−4
@@ -542,9 +542,9 @@ static void error1(int mode, const char *fmt, va_list ap) · 541 unmodified lines
542542 tcc_exit_state();
543543
544544 if (mode == ERROR_WARN) {
545− if (s1->warn_none)
545+ if (s1->warn_mask & WARN_DISABLED)
546546 return;
547− if (s1->warn_mask & (WARN_ERROR << WARN_ERROR_SHIFT))
547+ if (s1->warn_mask & WARN_ERROR_MASK) /* XXX individual ignorance */
548548 mode = ERROR_ERROR;
549549 }
550550
@@ -1976,12 +1976,12 @@ reparse: · 1425 unmodified lines
19761976 }
19771977 break;
19781978 case TCC_OPTION_W:
1979− s->warn_none = 0;
1979+ s->warn_mask &= ~WARN_DISABLED;
19801980 if (optarg[0] && set_W_flag(s, optarg) < 0)
19811981 goto unsupported_option;
19821982 break;
19831983 case TCC_OPTION_w:
1984− s->warn_none = 1;
1984+ s->warn_mask |= WARN_DISABLED;
19851985 break;
19861986 case TCC_OPTION_rdynamic:
19871987 s->rdynamic = 1;
tcc.c+6−6
@@ -36,7 +36,7 @@ static const char help[] = · 35 unmodified lines
3636 " -std=c99 Conform to the ISO 1999 C standard (default).\n"
3737 " -std=c11 Conform to the ISO 2011 C standard.\n"
3838 " -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"
4040 " --version -v show version\n"
4141 " -vv show search paths or loaded files\n"
4242 " -h -hh show this, show more help\n"
@@ -101,12 +101,12 @@ static const char help2[] = · 58 unmodified lines
101101 " -dt with -run/-E: auto-define 'test_...' macros\n"
102102 "Ignored options:\n"
103103 " --param -pedantic -pipe -s -traditional\n"
104− "-W... warnings:\n"
104+ "-W[no-]... warnings:\n"
105105 " 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"
110110 "-f[no-]... flags:\n"
111111 " unsigned-char default char is unsigned\n"
112112 " signed-char default char is signed\n"
tcc.h+9−4
@@ -744,10 +744,16 @@ enum warn_option { · 743 unmodified lines
744744 WARN_GCC_COMPAT = 1u<<1,
745745 WARN_WRITE_STRINGS = 1u<<2,
746746 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
749756 };
750−enum {WARN_ERROR_SHIFT = 16u};
751757
752758 struct TCCState {
753759 unsigned char verbose; /* if true, display some information during compilation */
@@ -779,7 +785,6 @@ struct TCCState { · 25 unmodified lines
779785 unsigned char dollars_in_identifiers; /* allows '$' char in identifiers */
780786 unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */
781787
782− unsigned char warn_none;
783788 /* NEED_WARNING(SELF,X) used to drive W[[no-]error]=X */
784789 uint32_t warn_mask;
785790 #define NEED_WARNING(SELF,SWITCH) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t