@@ -331,7 +331,6 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
331
331
var include string
332
332
f .cache .ExpectFile (sourcePath )
333
333
334
- includes := f .ctx .IncludeFolders
335
334
var preprocErr error
336
335
var preprocStderr []byte
337
336
if unchanged && f .cache .valid {
@@ -340,7 +339,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
340
339
f .ctx .GetLogger ().Println (constants .LOG_LEVEL_INFO , constants .MSG_USING_CACHED_INCLUDES , sourcePath )
341
340
}
342
341
} else {
343
- preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , includes )
342
+ preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , f . ctx . IncludeFolders )
344
343
// Unwrap error and see if it is an ExitError.
345
344
_ , isExitError := errors .Cause (preprocErr ).(* exec.ExitError )
346
345
if preprocErr == nil {
@@ -372,7 +371,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
372
371
// return errors.WithStack(err)
373
372
if preprocErr == nil || preprocStderr == nil {
374
373
// Filename came from cache, so run preprocessor to obtain error to show
375
- preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , includes )
374
+ preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , f . ctx . IncludeFolders )
376
375
if preprocErr == nil {
377
376
// If there is a missing #include in the cache, but running
378
377
// gcc does not reproduce that, there is something wrong.
@@ -392,7 +391,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
392
391
f .appendIncludeFolder (sourcePath , include , library .SourceDir )
393
392
if library .UtilityDir != nil {
394
393
// TODO: Use library.SourceDirs() instead?
395
- includes = append (includes , library .UtilityDir )
394
+ f . ctx . IncludeFolders = append (f . ctx . IncludeFolders , library .UtilityDir )
396
395
}
397
396
sourceDirs := library .SourceDirs ()
398
397
for _ , sourceDir := range sourceDirs {
0 commit comments