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