@@ -342,8 +342,6 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
342
342
var include string
343
343
f .cache .ExpectFile (sourcePath )
344
344
345
- includes := f .ctx .IncludeFolders
346
-
347
345
var preprocErr error
348
346
var preprocStderr []byte
349
347
if unchanged && f .cache .valid {
@@ -352,7 +350,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
352
350
f .ctx .Info (tr ("Using cached library dependencies for file: %[1]s" , sourcePath ))
353
351
}
354
352
} else {
355
- preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , includes )
353
+ preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , f . ctx . IncludeFolders )
356
354
// Unwrap error and see if it is an ExitError.
357
355
_ , isExitError := errors .Cause (preprocErr ).(* exec.ExitError )
358
356
if preprocErr == nil {
@@ -384,7 +382,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
384
382
// return errors.WithStack(err)
385
383
if preprocErr == nil || preprocStderr == nil {
386
384
// Filename came from cache, so run preprocessor to obtain error to show
387
- preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , includes )
385
+ preprocStderr , preprocErr = GCCPreprocRunnerForDiscoveringIncludes (f .ctx , sourcePath , targetFilePath , f . ctx . IncludeFolders )
388
386
if preprocErr == nil {
389
387
// If there is a missing #include in the cache, but running
390
388
// gcc does not reproduce that, there is something wrong.
@@ -404,7 +402,7 @@ func (f *CppIncludesFinder) findIncludesUntilDone(sourceFile SourceFile) error {
404
402
f .appendIncludeFolder (sourcePath , include , library .SourceDir )
405
403
if library .UtilityDir != nil {
406
404
// TODO: Use library.SourceDirs() instead?
407
- includes = append (includes , library .UtilityDir )
405
+ f . ctx . IncludeFolders = append (f . ctx . IncludeFolders , library .UtilityDir )
408
406
}
409
407
sourceDirs := library .SourceDirs ()
410
408
for _ , sourceDir := range sourceDirs {
0 commit comments