+2002-09-03 Borut Razem <borut.razem@siol.net>
+ * sdcc/src/SDCCglue.c, sdcc/src/SDCCglue.h, sdcc/src/SDCCmain.c,
+ sdcc/src/pic/glue.c:
+ introduced atexit() handler for teporay files removal in case of
+ errors, assertions, ...
+
2002-08-29 Borut Razem <borut.razem@siol.net>
* sdcc/support/cpp2/auto-host_vc_in.h:
re-definition of O_BINARY and other O_XXX as _O_BINARY and _O_XXX, so the problem
ralloc.c(1442) : warning C4700: local variable 'clr' used without having been initialized
2002-08-28 Bernhard Held <bernhard@bernhardheld.de>
- * src/SDCCglue.c (printIvalArray): iterative calculation of array length
+ * src/SDCCglue.c (printIvalArray): iterative calculation of array length
2002-08-28 Jesus Calvino-Fraga and Borut Razem <borut.razem@siol.net>
* sdcc/sdcc.dsw: added sdcpp, sdcppa, yacc, conf projects
}
/*-----------------------------------------------------------------*/
-/* rmTmpFiles - closes all tmp files created by the compiler */
+/* rmTmpFiles - unlinks all tmp files created by the compiler */
/* because of BRAIN DEAD MS/DOS & CYGNUS Libraries */
/*-----------------------------------------------------------------*/
DEFSETFUNC (rmTmpFiles)
return 0;
}
+/*-----------------------------------------------------------------*/
+/* rm_tmpfiles - close and remove temporary files and delete sets */
+/*-----------------------------------------------------------------*/
+void
+rm_tmpfiles (void)
+{
+ /* close temporary files */
+ applyToSet (tmpfileSet, closeTmpFiles);
+ /* remove temporary files */
+ applyToSet (tmpfileNameSet, rmTmpFiles);
+ /* delete temorary file sets */
+ deleteSet (&tmpfileSet);
+ deleteSet (&tmpfileNameSet);
+}
+
/*-----------------------------------------------------------------*/
/* copyFile - copies source file to destination file */
/*-----------------------------------------------------------------*/
/* emitMaps - emits the code for the data portion the code */
/*-----------------------------------------------------------------*/
void
-emitMaps ()
+emitMaps (void)
{
inInitMode++;
/* no special considerations for the following
/* glue - the final glue that hold the whole thing together */
/*-----------------------------------------------------------------*/
void
-glue ()
+glue (void)
{
FILE *vFile;
FILE *asmFile;
port->genAssemblerEnd(asmFile);
}
fclose (asmFile);
- applyToSet (tmpfileSet, closeTmpFiles);
- applyToSet (tmpfileNameSet, rmTmpFiles);
-}
-#if defined (__MINGW32__) || defined (__CYGWIN__) || defined (_MSC_VER)
-void
-rm_tmpfiles (void)
-{
- applyToSet (tmpfileSet, closeTmpFiles);
- applyToSet (tmpfileNameSet, rmTmpFiles);
+ rm_tmpfiles ();
}
-#endif
/** Creates a temporary file name a'la tmpnam which avoids the bugs
in cygwin wrt c:\tmp.
#ifndef SDCCGLUE_H
#define SDCCGLUE_H 1
-void glue ();
+void glue (void);
/* drdani Jan 30 2000
This is needed in gen.c of z80 port */
char *aopLiteral (value *, int);
extern set *publics;
extern set *tmpfileSet;
-#if defined (__MINGW32__) || defined (__CYGWIN__) || defined (_MSC_VER)
void rm_tmpfiles (void);
-#endif
-
int
pointerTypeToGPByte (const int p_type, const char *iname, const char *oname);
/* Have to set cppoutfilename to something, even if just pre-processing. */
setMainValue ("cppoutfilename", preOutName ? preOutName : "");
-
+
if (options.verbose)
printf ("sdcc: Calling preprocessor...\n");
exit (1);
}
+ /* install atexit handler */
+ atexit(rm_tmpfiles);
+
/* Before parsing the command line options, do a
* search for the port and processor and initialize
* them if they're found. (We can't gurantee that these
yyparse ();
- if (!fatalError)
- {
- if (TARGET_IS_PIC) {
- /* TSD PIC port hack - if the PIC port option is enabled
- and SDCC is used to generate PIC code, then we will
- generate .asm files in gpasm's format instead of SDCC's
- assembler's format
- */
+ if (fatalError) {
+ // @FIX: Dario Vecchio 03-05-2001
+ if (preOutName) {
+ if (yyin && yyin != stdin)
+ fclose (yyin);
+ unlink (preOutName);
+ Safe_free (preOutName);
+ }
+ // EndFix
+ return 1;
+ }
+
+ if (TARGET_IS_PIC) {
+ /* TSD PIC port hack - if the PIC port option is enabled
+ and SDCC is used to generate PIC code, then we will
+ generate .asm files in gpasm's format instead of SDCC's
+ assembler's format
+ */
#if !OPT_DISABLE_PIC
- picglue ();
+ picglue ();
#endif
- } else {
- glue ();
- }
-
- if (fatalError)
- {
- // @FIX: Dario Vecchio 03-05-2001
- if (preOutName)
- {
- if (yyin && yyin != stdin)
- fclose (yyin);
- unlink (preOutName);
- Safe_free (preOutName);
- }
- // EndFix
- return 1;
- }
- if (!options.c1mode && !noAssemble)
- {
- if (options.verbose)
- printf ("sdcc: Calling assembler...\n");
- assemble (envp);
- }
- }
- else
- {
- // @FIX: Dario Vecchio 03-05-2001
- if (preOutName)
- {
- if (yyin && yyin != stdin)
- fclose (yyin);
- unlink (preOutName);
- Safe_free (preOutName);
- }
- // EndFix
- #if defined (__MINGW32__) || defined (__CYGWIN__) || defined (_MSC_VER)
- rm_tmpfiles();
- #endif
- return 1;
- }
+ }
+ else {
+ glue ();
+ }
+ if (!options.c1mode && !noAssemble)
+ {
+ if (options.verbose)
+ printf ("sdcc: Calling assembler...\n");
+ assemble (envp);
+ }
}
closeDumpFiles();
fprintf (asmFile,"\tend\n");
fclose (asmFile);
- applyToSet(tmpfileSet,closeTmpFiles);
- applyToSet(tmpfileNameSet, rmTmpFiles);
+
+ rm_tmpfiles();
}