Bon, j'ai encore trouvé deux bugs dans le frontend :\
1°/ Il prétend qu'il n'y a aucun fichier (et ne fait rien) dès qu'il n'y a aucun fichier source, alors qu'on devrait pouvoir le lancer uniquement pour linker, donc avec seulement des fichiers objet...
2°/ Il ignore l'option -o quand on met aussi -c ou -S
Je les ai corrigés, je mets le patch ici pour que tout le monde y ait accès (c'est relativement court et ça évitera de devoir re-télécharger toute l'archive sur le site de Kevin pour ceux qui l'ont déjà fait...)
Bon, à part ça, il serait sympathique que ça refuse l'option -o quand il y a aussi -c ou -S et plusieurs fichiers en entrée (là ça va juste écraser bêtement le même fichier n fois de suite), mais je n'ai pas le temps de m'en occuper.
*** tigcc.c~ Sun Sep 21 19:28:25 2003
--- tigcc.c Sun Sep 21 19:25:26 2003
*************** void compile(char *file)
*** 390,404 ****
execute(gcc_name, gcc_argv);
}
else {
! char *tmpfile = malloc (strlen (file) + 3);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
! }
! strcpy(tmpfile, file);
! change_extension(tmpfile, ".s");
if (debug) gcc_argv[local_argc++] = "-gcoff";
gcc_argv[local_argc++] = "-S";
--- 390,408 ----
execute(gcc_name, gcc_argv);
}
else {
! char *tmpfile;
! if (!do_assemble && outfile) tmpfile = outfile;
! else {
! tmpfile = malloc (strlen (file) + 3);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
! }
! strcpy(tmpfile, file);
! change_extension(tmpfile, ".s");
! }
if (debug) gcc_argv[local_argc++] = "-gcoff";
gcc_argv[local_argc++] = "-S";
*************** void assemble(char *file)
*** 426,449 ****
{
char as_name[strlen(tigcc_base) + sizeof (BIN_BASE) + 8];
char includedir[strlen(tigcc_base) + 13];
! char *tmpfile = malloc (strlen (file) + 3);
char *argv[7 + (as_args ? strlen (as_args) / 2 : 0)];
argv[0] = as_name;
argv[1] = "-mc68000";
argv[2] = includedir;
argv[3] = file;
argv[4] = "-o";
- argv[5] = tmpfile;
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
}
!
sprintf (as_name, "%s/bin/%sas", tigcc_base, BIN_BASE);
sprintf (includedir, "-I%s/include/s", tigcc_base);
- strcpy(tmpfile, file);
- change_extension(tmpfile, ".o");
// add the file to the list
add_to_file_array(tmpfile, obj_files);
--- 430,457 ----
{
char as_name[strlen(tigcc_base) + sizeof (BIN_BASE) + 8];
char includedir[strlen(tigcc_base) + 13];
! char *tmpfile;
char *argv[7 + (as_args ? strlen (as_args) / 2 : 0)];
argv[0] = as_name;
argv[1] = "-mc68000";
argv[2] = includedir;
argv[3] = file;
argv[4] = "-o";
! if (!do_link && outfile) tmpfile = outfile;
! else {
! tmpfile = malloc (strlen (file) + 3);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
! }
! strcpy(tmpfile, file);
! change_extension(tmpfile, ".o");
}
!
! argv[5] = tmpfile;
sprintf (as_name, "%s/bin/%sas", tigcc_base, BIN_BASE);
sprintf (includedir, "-I%s/include/s", tigcc_base);
// add the file to the list
add_to_file_array(tmpfile, obj_files);
*************** void convert(void)
*** 568,579 ****
/* Execute A68K */
void a68k(char *file)
{
! char *tmpfile = malloc (strlen (file) + 5);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
}
!
/* First, assemble file with A68k which produces AmigaOS files */
{
--- 576,601 ----
/* Execute A68K */
void a68k(char *file)
{
! char *tmpfile;
! if (!do_link && outfile) {
! tmpfile = malloc (strlen (outfile) + 3);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
! }
! sprintf(tmpfile, "-o%s", outfile);
}
! else {
! tmpfile = malloc (strlen (file) + 5);
! if (!tmpfile) {
! fprintf(stderr, "Fatal error: not enough free memory\n");
! exit(-1);
! }
! sprintf(tmpfile, "-o%s", file);
! change_extension(tmpfile, ".o");
! }
! tmpfile += 2; /* Warning: this prevents free_file_array from working */
!
/* First, assemble file with A68k which produces AmigaOS files */
{
*************** void a68k(char *file)
*** 590,599 ****
sprintf (a68k_name, "%s/bin/a68k", tigcc_base);
sprintf (includedir, "-i%s/include/asm/", tigcc_base);
- sprintf(tmpfile, "-o%s", file);
- tmpfile += 2; /* Warning: this prevents free_file_array from working */
- change_extension(tmpfile, ".o");
-
// add the file to the list
add_to_file_array(tmpfile, obj_files);
--- 612,617 ----
*************** int main(int argc, char *argv[])
*** 825,831 ****
parse_args(&argc, argv);
// check there is at least one file to process
! if(!src_files->count && !asm_files->count && !a68k_files->count)
{
fprintf(stderr, "tigcc: no input files\n");
exit(0);
--- 843,849 ----
parse_args(&argc, argv);
// check there is at least one file to process
! if(!src_files->count && !asm_files->count && !a68k_files->count && !obj_files->count)
{
fprintf(stderr, "tigcc: no input files\n");
exit(0);