__pragma: Check if the option string is packed/unpacked in a more reliable way
This commit is contained in:
parent
4a4ba1e8b9
commit
3a9cfd8e46
@ -1009,6 +1009,7 @@ SC_VDECL int pc_retexpr; /* true if the current expression is a part of a "
|
|||||||
SC_VDECL int pc_retheap; /* heap space (in bytes) to be manually freed when returning an array returned by another function */
|
SC_VDECL int pc_retheap; /* heap space (in bytes) to be manually freed when returning an array returned by another function */
|
||||||
SC_VDECL int pc_nestlevel; /* number of active (open) compound statements */
|
SC_VDECL int pc_nestlevel; /* number of active (open) compound statements */
|
||||||
SC_VDECL unsigned int pc_attributes;/* currently set attribute flags (for the "__pragma" operator) */
|
SC_VDECL unsigned int pc_attributes;/* currently set attribute flags (for the "__pragma" operator) */
|
||||||
|
SC_VDECL int pc_ispackedstr; /* true if the last tokenized string is packed */
|
||||||
|
|
||||||
SC_VDECL char *sc_tokens[];
|
SC_VDECL char *sc_tokens[];
|
||||||
|
|
||||||
|
@ -8308,8 +8308,11 @@ static void dopragma(void)
|
|||||||
do {
|
do {
|
||||||
/* read the option string */
|
/* read the option string */
|
||||||
tok=lex(&val,&str);
|
tok=lex(&val,&str);
|
||||||
if (tok!=tSTRING) {
|
if (tok!=tSTRING || !pc_ispackedstr) {
|
||||||
|
/* either not a string, or the user prepended "!" to the option string */
|
||||||
char tokstr[2];
|
char tokstr[2];
|
||||||
|
if (tok==tSTRING)
|
||||||
|
tok='!';
|
||||||
if (tok<tFIRST) {
|
if (tok<tFIRST) {
|
||||||
sprintf(tokstr,"%c",tok);
|
sprintf(tokstr,"%c",tok);
|
||||||
str=tokstr;
|
str=tokstr;
|
||||||
@ -8321,12 +8324,6 @@ static void dopragma(void)
|
|||||||
} /* if */
|
} /* if */
|
||||||
assert(litidx>bck_litidx);
|
assert(litidx>bck_litidx);
|
||||||
|
|
||||||
/* the user shouldn't prepend "!" to the option string */
|
|
||||||
if (litq[val]<=UNPACKEDMAX && litq[val]!=0) {
|
|
||||||
error(1,sc_tokens[tSTRING-tFIRST],"!");
|
|
||||||
goto next;
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
/* swap the cell bytes if we're on a Little Endian platform */
|
/* swap the cell bytes if we're on a Little Endian platform */
|
||||||
#if BYTE_ORDER==LITTLE_ENDIAN
|
#if BYTE_ORDER==LITTLE_ENDIAN
|
||||||
{ /* local */
|
{ /* local */
|
||||||
|
@ -2415,6 +2415,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
|||||||
if ((stringflags & RAWMODE)!=0)
|
if ((stringflags & RAWMODE)!=0)
|
||||||
lptr+=1; /* skip "escape" character too */
|
lptr+=1; /* skip "escape" character too */
|
||||||
lptr=sc_packstr ? packedstring(lptr,&stringflags) : unpackedstring(lptr,&stringflags);
|
lptr=sc_packstr ? packedstring(lptr,&stringflags) : unpackedstring(lptr,&stringflags);
|
||||||
|
pc_ispackedstr=sc_packstr;
|
||||||
if (*lptr=='\"')
|
if (*lptr=='\"')
|
||||||
lptr+=1; /* skip final quote */
|
lptr+=1; /* skip final quote */
|
||||||
else if (!(stringflags & STRINGIZE))
|
else if (!(stringflags & STRINGIZE))
|
||||||
@ -2441,6 +2442,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
|||||||
if ((stringflags & RAWMODE)!=0)
|
if ((stringflags & RAWMODE)!=0)
|
||||||
lptr+=1; /* skip "escape" character too */
|
lptr+=1; /* skip "escape" character too */
|
||||||
lptr=sc_packstr ? unpackedstring(lptr,&stringflags) : packedstring(lptr,&stringflags);
|
lptr=sc_packstr ? unpackedstring(lptr,&stringflags) : packedstring(lptr,&stringflags);
|
||||||
|
pc_ispackedstr=!sc_packstr;
|
||||||
if (*lptr=='\"')
|
if (*lptr=='\"')
|
||||||
lptr+=1; /* skip final quote */
|
lptr+=1; /* skip final quote */
|
||||||
else if (!(stringflags & STRINGIZE))
|
else if (!(stringflags & STRINGIZE))
|
||||||
|
@ -102,6 +102,7 @@ SC_VDEFINE int pc_retexpr=FALSE; /* true if the current expression is
|
|||||||
SC_VDEFINE int pc_retheap=0; /* heap space (in bytes) to be manually freed when returning an array returned by another function */
|
SC_VDEFINE int pc_retheap=0; /* heap space (in bytes) to be manually freed when returning an array returned by another function */
|
||||||
SC_VDEFINE int pc_nestlevel=0; /* number of active (open) compound statements */
|
SC_VDEFINE int pc_nestlevel=0; /* number of active (open) compound statements */
|
||||||
SC_VDEFINE unsigned int pc_attributes=0; /* currently set attribute flags (for the "__pragma" operator) */
|
SC_VDEFINE unsigned int pc_attributes=0; /* currently set attribute flags (for the "__pragma" operator) */
|
||||||
|
SC_VDEFINE int pc_ispackedstr=FALSE; /* true if the last tokenized string is packed */
|
||||||
|
|
||||||
SC_VDEFINE char *sc_tokens[] = {
|
SC_VDEFINE char *sc_tokens[] = {
|
||||||
"*=", "/=", "%=", "+=", "-=", "<<=", ">>>=", ">>=", "&=", "^=", "|=",
|
"*=", "/=", "%=", "+=", "-=", "<<=", ">>>=", ">>=", "&=", "^=", "|=",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user