aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-14 14:07:37 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-14 14:45:37 +0200
commit991110ce9de9f08b90471c43b8143754becc0c67 (patch)
tree380828c8ea669e1e98215aaa78c0b4d27edac888 /pkg/csource
parentbdf3cf726780d1cfcaf3f5ebd08572d2948b565b (diff)
pkg/csource: add comment re ignoring cpp errors
Clarify why we ignore cpp errors.
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/common.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/csource/common.go b/pkg/csource/common.go
index a4adf3a56..f1e8a21b4 100644
--- a/pkg/csource/common.go
+++ b/pkg/csource/common.go
@@ -42,8 +42,15 @@ func createCommonHeader(p, mmapProg *prog.Prog, replacements map[string]string,
stdout := new(bytes.Buffer)
cmd.Stderr = stderr
cmd.Stdout = stdout
+ // Note: we ignore error because we pass -nostdinc so there are lots of errors of the form:
+ // error: no include path in which to search for stdlib.h
+ // This is exactly what we want: we don't want these to be included into the C reproducer.
+ // But the downside is that we can miss some real errors, e.g.:
+ // error: missing binary operator before token "SYZ_SANDBOX_ANDROID"
+ // 3776 | #if not SYZ_SANDBOX_ANDROID
+ // Potentially we could analyze errors manually and ignore only the expected ones.
if err := cmd.Run(); len(stdout.Bytes()) == 0 {
- return nil, fmt.Errorf("cpp failed: %v\n%v\n%v", err, stdout.String(), stderr.String())
+ return nil, fmt.Errorf("cpp failed: %v %v: %v\n%v\n%v", cmd.Path, cmd.Args, err, stdout.String(), stderr.String())
}
src, err := removeSystemDefines(stdout.Bytes(), defines)