History

-W[no-]error: fix previous

Steffen Nurpmeso committed 5 years ago

Commit 0d59ac41 parent 0c167622 files · +4 −5Browse files

Unified · Split

2 files
  1. libtcc.c +2 −2
  2. tcc.h +2 −3
libtcc.c+2−2
@@ -544,7 +544,7 @@ static void error1(int mode, const char *fmt, va_list ap) · 543 unmodified lines
544544 if (mode == ERROR_WARN) {
545545 if (s1->warn_none)
546546 return;
547− if (s1->warn_error)
547+ if (s1->warn_mask & (WARN_ERROR << WARN_ERROR_SHIFT))
548548 mode = ERROR_ERROR;
549549 }
550550
@@ -1288,7 +1288,7 @@ ST_FUNC int set_W_flag(TCCState *s, const char *optarg) · 737 unmodified lines
12881288 char const *name;
12891289 } const opts[] = {
12901290 {WARN_ALL, 0, "all"},
1291− {WARN_ERROR, 0, "error"},
1291+ {WARN_ERROR | (WARN_ERROR << WARN_ERROR_SHIFT), 0, "error"},
12921292 {WARN_UNSUPPORTED, WD_ERROR, "unsupported"},
12931293 {WARN_GCC_COMPAT, WD_ERROR, "gcc-compat"},
12941294 {WARN_WRITE_STRINGS, WD_ERROR | WD_ALL, "write-strings"},
tcc.h+2−3
@@ -744,7 +744,7 @@ 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,
747+ WARN_ERROR = 1u<<4, /* Not really as such in warn area, here only "MAX" */
748748 WARN_ALL = WARN_ERROR - 1
749749 };
750750 enum {WARN_ERROR_SHIFT = 16u};
@@ -780,14 +780,13 @@ struct TCCState { · 29 unmodified lines
780780 unsigned char ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */
781781
782782 unsigned char warn_none;
783− unsigned char warn_error;
784783 /* NEED_WARNING(SELF,X) used to drive W[[no-]error]=X */
785784 uint32_t warn_mask;
786785 #define NEED_WARNING(SELF,SWITCH) \
787786 (((SELF)->warn_mask & \
788787 (WARN_ ## SWITCH | (WARN_ ## SWITCH << WARN_ERROR_SHIFT))) \
789788 ? (((SELF)->warn_mask & (WARN_ ## SWITCH << WARN_ERROR_SHIFT)) \
790− ? (SELF)->warn_error = 1 : 1) : 0)
789+ ? (SELF)->warn_mask |= (WARN_ERROR << WARN_ERROR_SHIFT), 1 : 1) : 0)
791790
792791 /* compile with debug symbol (and use them if error during execution) */
793792 unsigned char do_debug;

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