X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmain.c;h=12909d3b01abdb824a3eb09c0f60bd690b8c5223;hb=80972b2e54c9b88f11c27b878874fd2a6a681391;hp=ec234ecb2713f200424ec341d73b980ac2b4148b;hpb=eaa91096bbf4af190d0da62f7d85b353d6f67e67;p=fw%2Fsdcc diff --git a/src/SDCCmain.c b/src/SDCCmain.c index ec234ecb..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; @@ -2049,7 +2049,7 @@ preProcess (char **envp) /* standard include path */ if (!options.nostdinc) { - inclList = appendStrSet(includeDirsSet, "-I\"", "\""); + inclList = appendStrSet(includeDirsSet, "-isystem \"", "\""); mergeSets(&preArgvSet, inclList); } @@ -2254,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)