Skip to content

Commit b0e9e3b

Browse files
committed
compilation database: Do not give-up if prototype generation fails
1 parent bf4a784 commit b0e9e3b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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", "An error occurred adding prototypes: 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)