Skip to content
Snippets Groups Projects
Commit 0834fd7a authored by James K. Lowden's avatar James K. Lowden :anchor:
Browse files

accept string values of -D

parent e1839846
No related branches found
No related tags found
No related merge requests found
Pipeline #1769 failed
......@@ -759,10 +759,10 @@ defined_cmd( const char arg[] )
if(p) {
*p++ = '\0';
int pos, number;
if( 1 == sscanf(p, "%d%n", &number, &pos) ) {
if( size_t(pos) == strlen(p) ) {
if( 1 == sscanf(p, "%d%n", &number, &pos) && size_t(pos) == strlen(p) ) {
value = cdfval_t(number);
}
} else {
value = cdfval_t(p); // it's a string
}
}
......
......@@ -1087,7 +1087,7 @@ USE({SPC}FOR)? { return USE; }
FD/[[:blank:]]+ { parsing.need_level(false); return FD; }
SD/[[:blank:]]+ { parsing.need_level(false); return SD; }
{NAME} { yylval.string = strdup(yytext);
{NAME} { ydflval.string = yylval.string = strdup(yytext);
const char *value = is_numeric_constant(yytext);
return value? numstr_of(value) : NAME; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment