X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmain.c;h=8b1194ba888fa19275225c1249df88a9d786ab50;hb=5a1d5e778e85664f4e6657019348b4756b16eacb;hp=818f4fdfda80565cac6c74eaf9732aaea3712c27;hpb=dbb122d9717eadd84ad5a0e8cd35c30b2f231c76;p=fw%2Fsdcc diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 818f4fdf..8b1194ba 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -186,8 +186,8 @@ optionsTable[] = { { 0, OPTION_SMALL_MODEL, NULL, "internal data space is used (default)" }, { 0, "--stack-auto", &options.stackAuto, "Stack automatic variables" }, { 0, "--xstack", &options.useXstack, "Use external stack" }, - { 0, "--int-long-reent", &options.intlong_rent, "Use reenterant calls on the int and long support functions" }, - { 0, "--float-reent", &options.float_rent, "Use reenterant calls on the float support functions" }, + { 0, "--int-long-reent", &options.intlong_rent, "Use reentrant calls on the int and long support functions" }, + { 0, "--float-reent", &options.float_rent, "Use reentrant calls on the float support functions" }, { 0, "--main-return", &options.mainreturn, "Issue a return after main()" }, { 0, "--xram-movc", &options.xram_movc, "Use movc instead of movx to read xram (xdata)" }, { 0, OPTION_CALLEE_SAVES, &options.calleeSavesSet, " Cause the called function to save registers insted of the caller", CLAT_SET }, @@ -283,7 +283,7 @@ static const char *_baseValues[] = { NULL }; -static const char *_preCmd = "{cpp} -nostdinc -Wall -std=c99 {cppextraopts} \"{fullsrcfilename}\" \"{cppoutfilename}\""; +static const char *_preCmd = "{cpp} -nostdinc -Wall {cppstd}{cppextraopts} \"{fullsrcfilename}\" \"{cppoutfilename}\""; PORT *port; @@ -426,8 +426,8 @@ printVersionInfo (FILE *stream) #ifdef SDCC_SUB_VERSION_STR "/" SDCC_SUB_VERSION_STR #endif - " #%s (" __DATE__ ") (%s)\n", - getBuildNumber(), getBuildEnvironment() ); + " #%s (%s) (%s)\n", + getBuildNumber(), getBuildDate(), getBuildEnvironment() ); } static void @@ -1490,11 +1490,11 @@ linkEdit (char **envp) /* if code size specified */ if (options.code_size) fprintf (lnkfile, "-w 0x%04x\n", options.code_size); - - if (options.debug) - fprintf (lnkfile, "-z\n"); } + if (options.debug) + fprintf (lnkfile, "-z\n"); + #define WRITE_SEG_LOC(N, L) \ if (N) \ { \ @@ -1988,6 +1988,9 @@ preProcess (char **envp) if (options.noOverlay) addSet(&preArgvSet, Safe_strdup("-DSDCC_NOOVERLAY")); + if (options.unsigned_char) + addSet(&preArgvSet, Safe_strdup("-DSDCC_CHAR_UNSIGNED")); + /* set the macro for large model */ switch (options.model) { @@ -2014,6 +2017,14 @@ preProcess (char **envp) break; } + /* set macro corresponding to compiler option */ + if (options.intlong_rent) + addSet(&preArgvSet, Safe_strdup("-DSDCC_INT_LONG_REENT")); + + /* set macro corresponding to compiler option */ + if (options.float_rent) + addSet(&preArgvSet, Safe_strdup("-DSDCC_FLOAT_REENT")); + /* add SDCC version number */ { char buf[20]; @@ -2022,6 +2033,13 @@ preProcess (char **envp) addSet(&preArgvSet, Safe_strdup(buf)); } + /* add SDCC revision number */ + { + char buf[25]; + SNPRINTF(buf, sizeof(buf), "-DSDCC_REVISION=%s", getBuildNumber()); + addSet(&preArgvSet, Safe_strdup(buf)); + } + /* add port (processor information to processor */ addSet(&preArgvSet, Safe_strdup("-DSDCC_{port}")); addSet(&preArgvSet, Safe_strdup("-D__{port}")); @@ -2034,7 +2052,7 @@ preProcess (char **envp) /* standard include path */ if (!options.nostdinc) { - inclList = appendStrSet(includeDirsSet, "-I\"", "\""); + inclList = appendStrSet(includeDirsSet, "-isystem \"", "\""); mergeSets(&preArgvSet, inclList); } @@ -2239,6 +2257,20 @@ initValues (void) setMainValue ("linkdstfilename", "{stdlinkdstfilename}"); } + /* + * Make sure the preprocessor is called with the "-std" option + * corresponding to the --std used to start sdcc + */ + if (options.std_c99) + { + if (!options.std_sdcc) + setMainValue ("cppstd", "-std=c99 "); + } + else + { + if (!options.std_sdcc) + setMainValue ("cppstd", "-std=c89 "); + } } static void doPrintSearchDirs(void)