@@ -8157,7 +8157,6 @@ static void dopragma(void)
8157
8157
int tok ;
8158
8158
int bck_litidx ,bck_packstr ;
8159
8159
int i ;
8160
- int hasparams ;
8161
8160
cell val ;
8162
8161
char * str ;
8163
8162
@@ -8222,11 +8221,13 @@ static void dopragma(void)
8222
8221
8223
8222
/* split the option name from parameters */
8224
8223
str = (char * )& litq [val ];
8225
- for (i = 0 ; str [i ]!= '\0' && str [i ]!= ' ' ; i ++ ) {}
8226
- hasparams = (str [i ]!= '\0' );
8227
- str [i ]= '\0' ;
8228
- if (hasparams )
8229
- while (str [++ i ]== ' ' ) {}
8224
+ for (i = 0 ; str [i ]!= '\0' && str [i ]!= ' ' ; i ++ )
8225
+ /* nothing */ ;
8226
+ if (str [i ]!= '\0' ) {
8227
+ str [i ]= '\0' ;
8228
+ while (str [++ i ]== ' ' )
8229
+ /* nothing */ ;
8230
+ } /* if */
8230
8231
8231
8232
/* check the option name, set the corresponding attribute flag
8232
8233
* and parse the argument(s), if needed */
@@ -8238,15 +8239,21 @@ static void dopragma(void)
8238
8239
pc_attributes |= (1U << attrDEPRECATED );
8239
8240
} else if (!strcmp (str ,"unused" )) {
8240
8241
pc_attributes |= (1U << attrUNUSED );
8242
+ if (str [i ]!= '\0' ) goto unknown_pragma ;
8241
8243
} else if (!strcmp (str ,"unread" )) {
8242
8244
pc_attributes |= (1U << attrUNREAD );
8245
+ if (str [i ]!= '\0' ) goto unknown_pragma ;
8243
8246
} else if (!strcmp (str ,"unwritten" )) {
8244
8247
pc_attributes |= (1U << attrUNWRITTEN );
8248
+ if (str [i ]!= '\0' ) goto unknown_pragma ;
8245
8249
} else if (!strcmp (str ,"nodestruct" )) {
8246
8250
pc_attributes |= (1U << attrNODESTRUCT );
8251
+ if (str [i ]!= '\0' ) goto unknown_pragma ;
8247
8252
} else if (!strcmp (str ,"naked" )) {
8248
8253
pc_attributes |= (1U << attrNAKED );
8254
+ if (str [i ]!= '\0' ) goto unknown_pragma ;
8249
8255
} else {
8256
+ unknown_pragma :
8250
8257
error (207 ); /* unknown #pragma */
8251
8258
} /* if */
8252
8259
0 commit comments