Removing exit calls from config parser

* config.h: cleanup, left only internally needed definitions
* config.c: removed exit calls, use yyerror and yywarning
* config_gram.y: (Dito.)
* lexer.l: (Dito.)
* libavrdude.h: removed internal definitions of config parser
* main.c: removed yyerror, it is now in config.c
* jtagmkII.c: added missing free in error case
* pgm.c: replaced exits by returns
* pickit2.c: add missing return



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1322 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher
2014-06-17 20:08:28 +00:00
parent c6788bd795
commit 2d2f71fb28
10 changed files with 329 additions and 207 deletions

22
lexer.l
View File

@@ -30,6 +30,7 @@
#include "avrdude.h"
#include "libavrdude.h"
#include "config.h"
#include "config_gram.h"
@@ -94,12 +95,8 @@ SIGN [+-]
}
if (c == EOF) {
avrdude_message(MSG_INFO, "error at %s:%d: EOF in comment\n",
infile, lineno);
avrdude_message(MSG_INFO, " comment started on line %d\n",
comment_start);
exit(1);
break;
yyerror("EOF in comment (started on line %d)", comment_start);
return YYERRCODE;
}
}
}
@@ -115,9 +112,9 @@ SIGN [+-]
<strng>\\(.|\n) *(string_buf_ptr++) = yytext[1];
<strng>[^\\\n\"]+ { char *yptr = yytext; while (*yptr)
*(string_buf_ptr++) = *(yptr++); }
<strng>\n { avrdude_message(MSG_INFO, "error at line %d: unterminated character constant\n",
lineno);
exit(1); }
<strng>\n { yyerror("unterminated character constant");
return YYERRCODE; }
allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
@@ -254,10 +251,9 @@ yes { yylval=new_token(K_YES); return K_YES; }
"\n" { lineno++; }
[ \r\t]+ { /* ignore whitespace */ }
c: { avrdude_message(MSG_INFO, "error at %s:%d: possible old-style config file entry\n",
infile, lineno);
avrdude_message(MSG_INFO, " Update your config file (see %s%s for a sample)\n",
CONFIG_DIR, "/avrdude.conf.sample");
c: { yyerror("possible old-style config file entry\n"
" Update your config file (see " CONFIG_DIR
"/avrdude.conf.sample for a sample)");
return YYERRCODE; }
. { return YYERRCODE; }