From 4271dd4550311c05bb3523865bb123645033c265 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 26 Mar 2014 14:20:18 -0400 Subject: [PATCH] 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 --- src/cmd/dist/build.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c index 6fd2f581ee..d898a31b9e 100644 --- a/src/cmd/dist/build.c +++ b/src/cmd/dist/build.c @@ -457,7 +457,6 @@ static char *proto_gccargs[] = { "-Wstrict-prototypes", "-Wextra", "-Wunused", - "-Wuninitialized", "-Wno-sign-compare", "-Wno-missing-braces", "-Wno-parentheses", @@ -469,17 +468,19 @@ static char *proto_gccargs[] = { "-fno-common", "-ggdb", "-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. // it is used if the environment isn't defining CFLAGS. 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__) + // 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 "-O2", #endif -- 2.50.0