{ 'Y', NULL, "use -I instead" }
};
+/** List of all default constant macros.
+ */
static const char *_baseValues[] = {
- "cpp", "{bindir}/sdcpp",
+ "cpp", "{bindir}{sep}sdcpp",
"cppextraopts", "",
+ /* Path seperator character */
+ "sep", DIR_SEPARATOR_STRING,
NULL
};
{
werror (E_FILE_OPEN_ERR, s);
exit (1);
- }
+ }
/* copy the file name into the buffer */
strcpy (buffer, s);
/* get rid of the "." */
strtok (buffer, ".");
- srcFileName = Safe_calloc (1, strlen (buffer) + 1);
+ srcFileName = Safe_alloc ( strlen (buffer) + 1);
strcpy (srcFileName, buffer);
/* get rid of any path information
*(fext - 1) != '/' &&
*(fext - 1) != ':')
fext--;
- moduleName = Safe_calloc (1, strlen (fext) + 1);
+ moduleName = Safe_alloc ( strlen (fext) + 1);
strcpy (moduleName, fext);
return;
werror (W_TOO_MANY_SRC, s);
return;
}
- options.out_name = strdup (s);
+ options.out_name = Safe_strdup (s);
}
else
{
fprintf (lnkfile, "-z\n");
#define WRITE_SEG_LOC(N, L) \
- segName = strdup(N); \
+ segName = Safe_strdup(N); \
c = strtok(segName, " \t"); \
fprintf (lnkfile,"-b %s = 0x%04x\n", c, L); \
- if (segName) { free(segName); }
+ if (segName) { Safe_free(segName); }
/* code segment start */
WRITE_SEG_LOC (CODE_NAME, options.code_loc);
}
else
{
- printf("Here 1\n");
buildCmdLine2 (buffer, port->linker.mcmd);
}
if (strcmp (srcFileName, "temp") == 0)
{
/* rename "temp.cdb" to "firstRelFile.cdb" */
- char *f = strtok (strdup (relFiles[0]), ".");
+ char *f = strtok (Safe_strdup (relFiles[0]), ".");
f = strcat (f, ".cdb");
rename ("temp.cdb", f);
srcFileName = NULL;
{
if (port->assembler.cmd)
{
- buildCmdLine (buffer, port->assembler.cmd, srcFileName, NULL, NULL, asmOptions);
+ buildCmdLine (buffer, port->assembler.cmd, srcFileName, NULL,
+ options.debug ? port->assembler.debug_opts : port->assembler.plain_opts,
+ asmOptions);
}
else
{
setMainValue ("cppextraopts", join(preArgv));
if (!preProcOnly)
- preOutName = strdup (tmpnam (NULL));
-
- setMainValue ("cppoutfilename", preOutName);
+ preOutName = Safe_strdup (tempfilename ());
+ /* Have to set cppoutfilename to something, even if just pre-processing. */
+ setMainValue ("cppoutfilename", preOutName ? preOutName : "");
+
if (options.verbose)
printf ("sdcc: Calling preprocessor...\n");
if (preOutName)
{
unlink (preOutName);
- free (preOutName);
+ Safe_free (preOutName);
}
// EndFix
exit (1);
configure time, see if the library and include directories are
where expected. If so, set.
*/
- getStringDifference (buffer, PREFIX, SDCC_INCLUDE_DIR);
+ getPathDifference (buffer, PREFIX, SDCC_INCLUDE_DIR);
strcpy (scratchFileName, pprefix);
strcat (scratchFileName, buffer);
return FALSE;
}
- getStringDifference (buffer, PREFIX, SDCC_LIB_DIR);
+ getPathDifference (buffer, PREFIX, SDCC_LIB_DIR);
strcpy (scratchFileName, pprefix);
strcat (scratchFileName, buffer);
strcpy (scratchFileName, argv0);
*strrchr (scratchFileName, DIR_SEPARATOR_CHAR) = '\0';
setMainValue ("bindir", scratchFileName);
- ExePathList[0] = gc_strdup (scratchFileName);
+ ExePathList[0] = Safe_strdup (scratchFileName);
}
else if (getenv (SDCCDIR_NAME) != NULL)
{
- getStringDifference (buffer, PREFIX, BINDIR);
+ getPathDifference (buffer, PREFIX, BINDIR);
strcpy (scratchFileName, getenv (SDCCDIR_NAME));
strcat (scratchFileName, buffer);
setMainValue ("bindir", scratchFileName);
- ExePathList[0] = gc_strdup (scratchFileName);
+ ExePathList[0] = Safe_strdup (scratchFileName);
}
else
{
}
else
{
- /* Include and lib wern't where expected. */
+ /* Include and lib weren't where expected. */
}
}
/* Case 2 */
if (yyin && yyin != stdin)
fclose (yyin);
unlink (preOutName);
- free (preOutName);
+ Safe_free (preOutName);
}
// EndFix
return 1;
if (yyin && yyin != stdin)
fclose (yyin);
unlink (preOutName);
- free (preOutName);
+ Safe_free (preOutName);
}
// EndFix
#if defined (__MINGW32__) || defined (__CYGWIN__) || defined (_MSC_VER)
if (preOutName && !options.c1mode)
{
unlink (preOutName);
- free (preOutName);
+ Safe_free (preOutName);
}
if (!options.cc_only &&