Hello! I have used GCC for decades and would like to contribute a little. :-)
I would like to see if I can improve the syntax errors. Here is one example code: int x = 3) + 0; I have created this ugly experimental patch: --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -2228,7 +2228,10 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, } else { - c_parser_error (parser, "expected %<,%> or %<;%>"); + if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) + c_parser_error (parser, "extraneous )"); + else + c_parser_error (parser, "expected %<,%> or %<;%>"); c_parser_skip_to_end_of_block_or_statement (parser); return; } Before my patch: test1.c:3:12: error: expected ‘,’ or ‘;’ before ‘)’ token After my patch: test1.c:3:12: error: extraneous ) before ‘)’ token That is not perfect neither. I have 2 questions.. * can somebody give me a hint how I improve the error message so it does not say "before ) token"? * how do I run the tests? Basically I want that when there is a unmatched extra ) or } or ] then it should just say "extraneous .." instead of "expected ',' or ';'. Adding a ',' or ';' in the example code will not fix the syntax error. Best regards, Daniel Marjamäki