From 47be383ea0d2fd1008fa37be6695634fe17ad805 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 13 Jun 2017 17:21:33 +0200 Subject: executor: fix clang-tidy warnings A single check is enabled for now (misc-definitions-in-headers). But it's always fixable and found 2 bugs in csource. --- csource/csource.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'csource/csource.go') diff --git a/csource/csource.go b/csource/csource.go index 6caac68bf..db610ce2e 100644 --- a/csource/csource.go +++ b/csource/csource.go @@ -175,6 +175,10 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) { func generateTestFunc(w io.Writer, opts Options, calls []string, name string) { if !opts.Threaded && !opts.Collide { fmt.Fprintf(w, "void %v()\n{\n", name) + if opts.Debug { + // Use debug to avoid: error: ‘debug’ defined but not used. + fmt.Fprintf(w, "\tdebug(\"%v\\n\");\n", name) + } if opts.Repro { fmt.Fprintf(w, "\tsyscall(SYS_write, 1, \"executing program\\n\", strlen(\"executing program\\n\"));\n") } @@ -198,6 +202,10 @@ func generateTestFunc(w io.Writer, opts Options, calls []string, name string) { fmt.Fprintf(w, "\tlong i;\n") fmt.Fprintf(w, "\tpthread_t th[%v];\n", 2*len(calls)) fmt.Fprintf(w, "\n") + if opts.Debug { + // Use debug to avoid: error: ‘debug’ defined but not used. + fmt.Fprintf(w, "\tdebug(\"%v\\n\");\n", name) + } if opts.Repro { fmt.Fprintf(w, "\tsyscall(SYS_write, 1, \"executing program\\n\", strlen(\"executing program\\n\"));\n") } @@ -387,7 +395,7 @@ func preprocessCommonHeader(opts Options, handled map[string]int, useBitmasks, u if useBitmasks { defines = append(defines, "SYZ_USE_BITMASKS") } - if useBitmasks { + if useChecksums { defines = append(defines, "SYZ_USE_CHECKSUMS") } switch opts.Sandbox { -- cgit mrf-deployment