X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmain.c;h=12909d3b01abdb824a3eb09c0f60bd690b8c5223;hb=bb226788dab3832b0ec0cda70874ce3fce4eebc6;hp=fd52d5920beb95903d9167125226e85b8c49c391;hpb=fc75ace6977db74b90eaf9c1deeae88dba4094c2;p=fw%2Fsdcc diff --git a/src/SDCCmain.c b/src/SDCCmain.c index fd52d592..12909d3b 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -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; @@ -2022,10 +2022,6 @@ preProcess (char **envp) if (options.float_rent) addSet(&preArgvSet, Safe_strdup("-DSDCC_FLOAT_REENT")); - /* set macro corresponding to compiler option */ - if (options.parms_in_bank1) - addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1")); - /* add SDCC version number */ { char buf[20]; @@ -2053,7 +2049,7 @@ preProcess (char **envp) /* standard include path */ if (!options.nostdinc) { - inclList = appendStrSet(includeDirsSet, "-I\"", "\""); + inclList = appendStrSet(includeDirsSet, "-isystem \"", "\""); mergeSets(&preArgvSet, inclList); } @@ -2258,6 +2254,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)