提交 936dcbcc 编写于 作者: M mikael

8007403: Incorrect format arguments in adlparse.cpp

Reviewed-by: kvn, twisti
上级 e1092eb6
...@@ -168,7 +168,7 @@ void ADLParser::instr_parse(void) { ...@@ -168,7 +168,7 @@ void ADLParser::instr_parse(void) {
// Check for block delimiter // Check for block delimiter
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '{')) ) { || ( next_char(), (_curchar != '{')) ) {
parse_err(SYNERR, "missing '%{' in instruction definition\n"); parse_err(SYNERR, "missing '%%{' in instruction definition\n");
return; return;
} }
next_char(); // Maintain the invariant next_char(); // Maintain the invariant
...@@ -253,7 +253,7 @@ void ADLParser::instr_parse(void) { ...@@ -253,7 +253,7 @@ void ADLParser::instr_parse(void) {
} while(_curchar != '%'); } while(_curchar != '%');
next_char(); next_char();
if (_curchar != '}') { if (_curchar != '}') {
parse_err(SYNERR, "missing '%}' in instruction definition\n"); parse_err(SYNERR, "missing '%%}' in instruction definition\n");
return; return;
} }
// Check for "Set" form of chain rule // Check for "Set" form of chain rule
...@@ -423,7 +423,7 @@ void ADLParser::oper_parse(void) { ...@@ -423,7 +423,7 @@ void ADLParser::oper_parse(void) {
skipws(); skipws();
// Check for block delimiter // Check for block delimiter
if ((_curchar != '%') || (*(_ptr+1) != '{')) { // If not open block if ((_curchar != '%') || (*(_ptr+1) != '{')) { // If not open block
parse_err(SYNERR, "missing '%c{' in operand definition\n","%"); parse_err(SYNERR, "missing '%%{' in operand definition\n");
return; return;
} }
next_char(); next_char(); // Skip over "%{" symbol next_char(); next_char(); // Skip over "%{" symbol
...@@ -483,7 +483,7 @@ void ADLParser::oper_parse(void) { ...@@ -483,7 +483,7 @@ void ADLParser::oper_parse(void) {
} while(_curchar != '%'); } while(_curchar != '%');
next_char(); next_char();
if (_curchar != '}') { if (_curchar != '}') {
parse_err(SYNERR, "missing '%}' in operand definition\n"); parse_err(SYNERR, "missing '%%}' in operand definition\n");
return; return;
} }
// Add operand to tail of operand list // Add operand to tail of operand list
...@@ -1324,7 +1324,7 @@ void ADLParser::pipe_parse(void) { ...@@ -1324,7 +1324,7 @@ void ADLParser::pipe_parse(void) {
// Check for block delimiter // Check for block delimiter
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '{')) ) { || ( next_char(), (_curchar != '{')) ) {
parse_err(SYNERR, "missing '%{' in pipeline definition\n"); parse_err(SYNERR, "missing '%%{' in pipeline definition\n");
return; return;
} }
next_char(); // Maintain the invariant next_char(); // Maintain the invariant
...@@ -1341,7 +1341,7 @@ void ADLParser::pipe_parse(void) { ...@@ -1341,7 +1341,7 @@ void ADLParser::pipe_parse(void) {
skipws(); skipws();
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '{')) ) { || ( next_char(), (_curchar != '{')) ) {
parse_err(SYNERR, "expected '%{'\n"); parse_err(SYNERR, "expected '%%{'\n");
return; return;
} }
next_char(); skipws(); next_char(); skipws();
...@@ -1397,7 +1397,7 @@ void ADLParser::pipe_parse(void) { ...@@ -1397,7 +1397,7 @@ void ADLParser::pipe_parse(void) {
skipws(); skipws();
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '{')) ) { || ( next_char(), (_curchar != '{')) ) {
parse_err(SYNERR, "expected '%{'\n"); parse_err(SYNERR, "expected '%%{'\n");
return; return;
} }
next_char(); skipws(); next_char(); skipws();
...@@ -1586,7 +1586,7 @@ void ADLParser::pipe_parse(void) { ...@@ -1586,7 +1586,7 @@ void ADLParser::pipe_parse(void) {
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '}')) ) { || ( next_char(), (_curchar != '}')) ) {
parse_err(SYNERR, "expected '%}', found \"%c\"\n", _curchar); parse_err(SYNERR, "expected '%%}', found \"%c\"\n", _curchar);
} }
next_char(); skipws(); next_char(); skipws();
...@@ -1612,7 +1612,7 @@ void ADLParser::pipe_parse(void) { ...@@ -1612,7 +1612,7 @@ void ADLParser::pipe_parse(void) {
next_char(); next_char();
if (_curchar != '}') { if (_curchar != '}') {
parse_err(SYNERR, "missing \"%}\" in pipeline definition\n"); parse_err(SYNERR, "missing \"%%}\" in pipeline definition\n");
return; return;
} }
...@@ -1775,7 +1775,7 @@ void ADLParser::pipe_class_parse(PipelineForm &pipeline) { ...@@ -1775,7 +1775,7 @@ void ADLParser::pipe_class_parse(PipelineForm &pipeline) {
// Check for block delimiter // Check for block delimiter
if ( (_curchar != '%') if ( (_curchar != '%')
|| ( next_char(), (_curchar != '{')) ) { || ( next_char(), (_curchar != '{')) ) {
parse_err(SYNERR, "missing \"%{\" in pipe_class definition\n"); parse_err(SYNERR, "missing \"%%{\" in pipe_class definition\n");
return; return;
} }
next_char(); next_char();
...@@ -2062,7 +2062,7 @@ void ADLParser::pipe_class_parse(PipelineForm &pipeline) { ...@@ -2062,7 +2062,7 @@ void ADLParser::pipe_class_parse(PipelineForm &pipeline) {
next_char(); next_char();
if (_curchar != '}') { if (_curchar != '}') {
parse_err(SYNERR, "missing \"%}\" in pipe_class definition\n"); parse_err(SYNERR, "missing \"%%}\" in pipe_class definition\n");
return; return;
} }
...@@ -3341,12 +3341,12 @@ Interface *ADLParser::mem_interface_parse(void) { ...@@ -3341,12 +3341,12 @@ Interface *ADLParser::mem_interface_parse(void) {
char *disp = NULL; char *disp = NULL;
if (_curchar != '%') { if (_curchar != '%') {
parse_err(SYNERR, "Missing '%{' for 'interface' block.\n"); parse_err(SYNERR, "Missing '%%{' for 'interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '%' next_char(); // Skip '%'
if (_curchar != '{') { if (_curchar != '{') {
parse_err(SYNERR, "Missing '%{' for 'interface' block.\n"); parse_err(SYNERR, "Missing '%%{' for 'interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '{' next_char(); // Skip '{'
...@@ -3354,7 +3354,7 @@ Interface *ADLParser::mem_interface_parse(void) { ...@@ -3354,7 +3354,7 @@ Interface *ADLParser::mem_interface_parse(void) {
do { do {
char *field = get_ident(); char *field = get_ident();
if (field == NULL) { if (field == NULL) {
parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n");
return NULL; return NULL;
} }
if ( strcmp(field,"base") == 0 ) { if ( strcmp(field,"base") == 0 ) {
...@@ -3370,13 +3370,13 @@ Interface *ADLParser::mem_interface_parse(void) { ...@@ -3370,13 +3370,13 @@ Interface *ADLParser::mem_interface_parse(void) {
disp = interface_field_parse(); disp = interface_field_parse();
} }
else { else {
parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n");
return NULL; return NULL;
} }
} while( _curchar != '%' ); } while( _curchar != '%' );
next_char(); // Skip '%' next_char(); // Skip '%'
if ( _curchar != '}' ) { if ( _curchar != '}' ) {
parse_err(SYNERR, "Missing '%}' for 'interface' block.\n"); parse_err(SYNERR, "Missing '%%}' for 'interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '}' next_char(); // Skip '}'
...@@ -3403,12 +3403,12 @@ Interface *ADLParser::cond_interface_parse(void) { ...@@ -3403,12 +3403,12 @@ Interface *ADLParser::cond_interface_parse(void) {
const char *greater_format = "gt"; const char *greater_format = "gt";
if (_curchar != '%') { if (_curchar != '%') {
parse_err(SYNERR, "Missing '%{' for 'cond_interface' block.\n"); parse_err(SYNERR, "Missing '%%{' for 'cond_interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '%' next_char(); // Skip '%'
if (_curchar != '{') { if (_curchar != '{') {
parse_err(SYNERR, "Missing '%{' for 'cond_interface' block.\n"); parse_err(SYNERR, "Missing '%%{' for 'cond_interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '{' next_char(); // Skip '{'
...@@ -3416,7 +3416,7 @@ Interface *ADLParser::cond_interface_parse(void) { ...@@ -3416,7 +3416,7 @@ Interface *ADLParser::cond_interface_parse(void) {
do { do {
char *field = get_ident(); char *field = get_ident();
if (field == NULL) { if (field == NULL) {
parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n");
return NULL; return NULL;
} }
if ( strcmp(field,"equal") == 0 ) { if ( strcmp(field,"equal") == 0 ) {
...@@ -3438,13 +3438,13 @@ Interface *ADLParser::cond_interface_parse(void) { ...@@ -3438,13 +3438,13 @@ Interface *ADLParser::cond_interface_parse(void) {
greater = interface_field_parse(&greater_format); greater = interface_field_parse(&greater_format);
} }
else { else {
parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n");
return NULL; return NULL;
} }
} while( _curchar != '%' ); } while( _curchar != '%' );
next_char(); // Skip '%' next_char(); // Skip '%'
if ( _curchar != '}' ) { if ( _curchar != '}' ) {
parse_err(SYNERR, "Missing '%}' for 'interface' block.\n"); parse_err(SYNERR, "Missing '%%}' for 'interface' block.\n");
return NULL; return NULL;
} }
next_char(); // Skip '}' next_char(); // Skip '}'
...@@ -3543,7 +3543,7 @@ MatchRule *ADLParser::match_parse(FormDict &operands) { ...@@ -3543,7 +3543,7 @@ MatchRule *ADLParser::match_parse(FormDict &operands) {
} }
else if ((cnstr = find_cpp_block("match constructor")) == NULL ) { else if ((cnstr = find_cpp_block("match constructor")) == NULL ) {
parse_err(SYNERR, "invalid construction of match rule\n" parse_err(SYNERR, "invalid construction of match rule\n"
"Missing ';' or invalid '%{' and '%}' constructor\n"); "Missing ';' or invalid '%%{' and '%%}' constructor\n");
return NULL; // No MatchRule to return return NULL; // No MatchRule to return
} }
if (_AD._adl_debug > 1) if (_AD._adl_debug > 1)
...@@ -3646,7 +3646,7 @@ FormatRule* ADLParser::format_parse(void) { ...@@ -3646,7 +3646,7 @@ FormatRule* ADLParser::format_parse(void) {
// Check for closing '"' and '%}' in format description // Check for closing '"' and '%}' in format description
skipws(); // Move to closing '%}' skipws(); // Move to closing '%}'
if ( _curchar != '%' ) { if ( _curchar != '%' ) {
parse_err(SYNERR, "non-blank characters between closing '\"' and '%' in format"); parse_err(SYNERR, "non-blank characters between closing '\"' and '%%' in format");
return NULL; return NULL;
} }
} // Done with format description inside } // Done with format description inside
...@@ -3654,7 +3654,7 @@ FormatRule* ADLParser::format_parse(void) { ...@@ -3654,7 +3654,7 @@ FormatRule* ADLParser::format_parse(void) {
skipws(); skipws();
// Past format description, at '%' // Past format description, at '%'
if ( _curchar != '%' || *(_ptr+1) != '}' ) { if ( _curchar != '%' || *(_ptr+1) != '}' ) {
parse_err(SYNERR, "missing '%}' at end of format block"); parse_err(SYNERR, "missing '%%}' at end of format block");
return NULL; return NULL;
} }
next_char(); // Move past the '%' next_char(); // Move past the '%'
...@@ -3785,7 +3785,7 @@ FormatRule* ADLParser::template_parse(void) { ...@@ -3785,7 +3785,7 @@ FormatRule* ADLParser::template_parse(void) {
skipws(); skipws();
// Past format description, at '%' // Past format description, at '%'
if ( _curchar != '%' || *(_ptr+1) != '}' ) { if ( _curchar != '%' || *(_ptr+1) != '}' ) {
parse_err(SYNERR, "missing '%}' at end of format block"); parse_err(SYNERR, "missing '%%}' at end of format block");
return NULL; return NULL;
} }
next_char(); // Move past the '%' next_char(); // Move past the '%'
...@@ -3834,7 +3834,7 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) { ...@@ -3834,7 +3834,7 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) {
skipws(); // Skip leading whitespace skipws(); // Skip leading whitespace
if ((_curchar != '%') if ((_curchar != '%')
|| (next_char(), (_curchar != '{')) ) { // If not open block || (next_char(), (_curchar != '{')) ) { // If not open block
parse_err(SYNERR, "missing '%{' in expand definition\n"); parse_err(SYNERR, "missing '%%{' in expand definition\n");
return(NULL); return(NULL);
} }
next_char(); // Maintain the invariant next_char(); // Maintain the invariant
...@@ -3933,7 +3933,7 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) { ...@@ -3933,7 +3933,7 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) {
} while(_curchar != '%'); } while(_curchar != '%');
next_char(); next_char();
if (_curchar != '}') { if (_curchar != '}') {
parse_err(SYNERR, "missing '%}' in expand rule definition\n"); parse_err(SYNERR, "missing '%%}' in expand rule definition\n");
return(NULL); return(NULL);
} }
next_char(); next_char();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册