mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-18 11:24:42 +00:00
bug #34302: Feature request : device configuration with parent classes
* config_gram.y: if memory section is overwritten old entry is removed
(not in original patch)
* config_gram.y: if programmer or part is defined twice, a warning is
output and the first instance is removed
General cleanup and free functions, so valgrind does not report any lost
blocks at program end.
* avrpart.[hc]: added avr_free_(opcode|mem|part) functions
* pgm.[hc]: added pgm_free function
* update.[hc]: added free_update functions
* config.[hc]: added cleanup_config function, use yylex_destroy to reset
the lexer after usage. (So it can be reused.)
* main.c: add cleanup_main function which is called by atexit() (This
frees all lists so that at program exit only really lost memory is
reported by valgrind.)
* usbasp.c: added libusb_free_device_list() and libusb_exit() calls to
avoid lost memory
* buspirate.c: moved memory allocation from initpgm to setup and added
free in teardown
* configure.ac: add definition of HAVE_YYLEX_DESTROY if $LEX is flex.
* Makefile.am: added . in front of SUBDIRS to build avrdude before trying
to use it for creating the part list for the docs.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1041 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
@@ -290,6 +290,8 @@ def :
|
||||
prog_def :
|
||||
prog_decl prog_parms
|
||||
{
|
||||
PROGRAMMER * existing_prog;
|
||||
char * id;
|
||||
if (lsize(current_prog->id) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: required parameter id not specified\n",
|
||||
@@ -301,6 +303,16 @@ prog_def :
|
||||
progname, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
id = ldata(lfirst(current_prog->id));
|
||||
existing_prog = locate_programmer(programmers, id);
|
||||
if (existing_prog) {
|
||||
fprintf(stderr, "%s: warning at %s:%d: programmer %s overwrites "
|
||||
"previous definition %s:%d.\n",
|
||||
progname, infile, current_prog->lineno,
|
||||
id, existing_prog->config_file, existing_prog->lineno);
|
||||
lrmv_d(programmers, existing_prog);
|
||||
pgm_free(existing_prog);
|
||||
}
|
||||
PUSH(programmers, current_prog);
|
||||
current_prog = NULL;
|
||||
}
|
||||
@@ -321,6 +333,7 @@ part_def :
|
||||
{
|
||||
LNODEID ln;
|
||||
AVRMEM * m;
|
||||
AVRPART * existing_part;
|
||||
|
||||
if (current_part->id[0] == 0) {
|
||||
fprintf(stderr,
|
||||
@@ -366,6 +379,15 @@ part_def :
|
||||
}
|
||||
}
|
||||
|
||||
existing_part = locate_part(part_list, current_part->id);
|
||||
if (existing_part) {
|
||||
fprintf(stderr, "%s: warning at %s:%d: part %s overwrites "
|
||||
"previous definition %s:%d.\n",
|
||||
progname, infile, current_part->lineno, current_part->id,
|
||||
existing_part->config_file, existing_part->lineno);
|
||||
lrmv_d(part_list, existing_part);
|
||||
avr_free_part(existing_part);
|
||||
}
|
||||
PUSH(part_list, current_part);
|
||||
current_part = NULL;
|
||||
}
|
||||
@@ -1146,6 +1168,13 @@ part_parm :
|
||||
}
|
||||
mem_specs
|
||||
{
|
||||
AVRMEM * existing_mem;
|
||||
|
||||
existing_mem = avr_locate_mem(current_part, current_mem->desc);
|
||||
if (existing_mem != NULL) {
|
||||
lrmv_d(current_part->mem, existing_mem);
|
||||
avr_free_mem(existing_mem);
|
||||
}
|
||||
ladd(current_part->mem, current_mem);
|
||||
current_mem = NULL;
|
||||
} |
|
||||
@@ -1162,7 +1191,7 @@ part_parm :
|
||||
/*fprintf(stderr,
|
||||
"%s: warning at %s:%d: operation redefined\n",
|
||||
progname, infile, lineno);*/
|
||||
free(current_part->op[opnum]);
|
||||
avr_free_opcode(current_part->op[opnum]);
|
||||
}
|
||||
current_part->op[opnum] = op;
|
||||
|
||||
@@ -1289,7 +1318,7 @@ mem_spec :
|
||||
/*fprintf(stderr,
|
||||
"%s: warning at %s:%d: operation redefined\n",
|
||||
progname, infile, lineno);*/
|
||||
free(current_mem->op[opnum]);
|
||||
avr_free_opcode(current_mem->op[opnum]);
|
||||
}
|
||||
current_mem->op[opnum] = op;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user