Skip to content

Commit 0ee1c67

Browse files
committed
Compilation database: Do not give-up if prototype generation fails
1 parent ec768b1 commit 0ee1c67

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: legacy/builder/container_add_prototypes.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ func (s *ContainerAddPrototypes) Run(ctx *types.Context) error {
3434
// Run preprocessor
3535
sourceFile := ctx.SketchBuildPath.Join(ctx.Sketch.MainFile.Base() + ".cpp")
3636
if err := GCCPreprocRunner(ctx, sourceFile, targetFilePath, ctx.IncludeFolders); err != nil {
37-
return errors.WithStack(err)
37+
if !ctx.OnlyUpdateCompilationDatabase {
38+
return errors.WithStack(err)
39+
}
40+
41+
// Do not bail out if we are generating the compile commands database
42+
ctx.GetLogger().Println("info", "%s: %s", tr("An error occurred adding prototypes"), tr("the compilation database may be incomplete or inaccurate"))
43+
if err := sourceFile.CopyTo(targetFilePath); err != nil {
44+
return errors.WithStack(err)
45+
}
3846
}
3947

4048
commands := []types.Command{

0 commit comments

Comments
 (0)