Commit 4271dd45 authored by Shenghou Ma's avatar Shenghou Ma

cmd/dist: set -Wuninitialized only when -O is also set.

GCC on OS X 10.6 doesn't support -Wuninitialized without -O.
Fixes #7492.

LGTM=iant
R=golang-codereviews, dave, iant
CC=golang-codereviews
https://golang.org/cl/72360045
parent 7c75a862
...@@ -457,7 +457,6 @@ static char *proto_gccargs[] = { ...@@ -457,7 +457,6 @@ static char *proto_gccargs[] = {
"-Wstrict-prototypes", "-Wstrict-prototypes",
"-Wextra", "-Wextra",
"-Wunused", "-Wunused",
"-Wuninitialized",
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-missing-braces", "-Wno-missing-braces",
"-Wno-parentheses", "-Wno-parentheses",
...@@ -469,17 +468,19 @@ static char *proto_gccargs[] = { ...@@ -469,17 +468,19 @@ static char *proto_gccargs[] = {
"-fno-common", "-fno-common",
"-ggdb", "-ggdb",
"-pipe", "-pipe",
#if defined(__NetBSD__) && defined(__arm__)
// GCC 4.5.4 (NetBSD nb1 20120916) on ARM is known to mis-optimize gc/mparith3.c
// Fix available at http://patchwork.ozlabs.org/patch/64562/.
"-O1",
#endif
}; };
// gccargs2 is the second part of gccargs. // gccargs2 is the second part of gccargs.
// it is used if the environment isn't defining CFLAGS. // it is used if the environment isn't defining CFLAGS.
static char *proto_gccargs2[] = { static char *proto_gccargs2[] = {
// on older versions of GCC, -Wuninitialized is not supported
// without -O, so put it here together with -O settings in case
// the user's $CFLAGS doesn't include -O.
"-Wuninitialized",
#if defined(__NetBSD__) && defined(__arm__) #if defined(__NetBSD__) && defined(__arm__)
// GCC 4.5.4 (NetBSD nb1 20120916) on ARM is known to mis-optimize gc/mparith3.c
// Fix available at http://patchwork.ozlabs.org/patch/64562/.
"-O1",
#else #else
"-O2", "-O2",
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment