Skip to content

Commit 362d298

Browse files
committed
Simplify the code for #pragma warning enable/disable
1 parent b971a19 commit 362d298

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

source/compiler/sc2.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,29 +1305,23 @@ static int command(void)
13051305
} else if (strcmp(str,"warning")==0) {
13061306
int ok=lex(&val,&str)==tSYMBOL;
13071307
if (ok) {
1308-
if (strcmp(str,"enable")==0) {
1308+
if (strcmp(str,"enable")==0 || strcmp(str,"disable")==0) {
13091309
cell val;
13101310
do {
13111311
preproc_expr(&val,NULL);
1312-
pc_enablewarning(val,1);
1313-
} while (*lptr!='\0');
1314-
} else if (strcmp(str,"disable")==0) {
1315-
cell val;
1316-
do {
1317-
preproc_expr(&val,NULL);
1318-
pc_enablewarning(val,0);
1312+
pc_enablewarning(val,(str[0]=='e') ? 1 : 0);
13191313
} while (*lptr!='\0');
13201314
} else if (strcmp(str,"push")==0) {
13211315
pc_pushwarnings();
13221316
} else if (strcmp(str,"pop")==0) {
13231317
pc_popwarnings();
13241318
} else {
13251319
ok=FALSE;
1326-
}
1320+
} /* if */
13271321
}
13281322
if (!ok) {
13291323
error(207); /* unknown #pragma */
1330-
}
1324+
} /* if */
13311325
} else if (strcmp(str,"compat")==0) {
13321326
cell val;
13331327
symbol *sym;

0 commit comments

Comments
 (0)