Skip to content

Commit

Permalink
dist: add clang specific -Wno options
Browse files Browse the repository at this point in the history
Clang 3.1 has more warnings enabled by default than GCC.
Combined with -Werror, they cause the build to fail
unnecessarily.  if the name of our compiler ends in "clang",
add the necessary extra -Wno options.  Ideally we would add
these flags unconditionally, as GCC is supposed to ignore
unknown -Wno flags, but apple's llvm-gcc doesn't.

Fixes #2878.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5673055
  • Loading branch information
bpowers authored and rsc committed Feb 16, 2012
1 parent 5c598d3 commit 7c2bfa4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cmd/dist/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,12 @@ install(char *dir)
splitfields(&gccargs, bstr(&b));
for(i=0; i<nelem(proto_gccargs); i++)
vadd(&gccargs, proto_gccargs[i]);
if(xstrstr(gccargs.p[0], "clang") != nil) {
vadd(&gccargs, "-Wno-dangling-else");
vadd(&gccargs, "-Wno-unused-value");
}
}

islib = hasprefix(dir, "lib") || streq(dir, "cmd/cc") || streq(dir, "cmd/gc");
ispkg = hasprefix(dir, "pkg");
isgo = ispkg || streq(dir, "cmd/go") || streq(dir, "cmd/cgo");
Expand Down

0 comments on commit 7c2bfa4

Please sign in to comment.