[llvm-commits] [PATCH 1/3] Disable -Wuninitialized for gcc

Eric Christopher echristo at gmail.com
Wed Jan 9 10:46:49 PST 2013


Oh painful. That said, probably about the best way of doing that.

One nit:

+if test "$GXX" = "yes"
+then

is usually done:

if test "x$GXX" = "xyes"; then

otherwise OK. Please go ahead and commit all 3 patches in this set in the
same commit.

Thanks!

-eric


On Tue, Jan 8, 2013 at 1:11 PM, David Greene <dag at cray.com> wrote:

> If the compiler is gcc, disable variants of -Wuninitialized depending
> on the gcc version.  This gets a lot of false positive warnings out of
> the build.
> ---
>  llvm/autoconf/configure.ac |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac
> index 102147c..e1bb046 100644
> --- a/llvm/autoconf/configure.ac
> +++ b/llvm/autoconf/configure.ac
> @@ -1231,7 +1231,27 @@ AC_MSG_CHECKING([optional compiler flags])
>  CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
>  CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS,
> [-Wno-missing-field-initializers])
>  CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
> -AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS
> $COVERED_SWITCH_DEFAULT])
> +dnl GCC's potential uninitialized use analysis is weak and presents lots
> of
> +dnl false positives, so disable it.
> +if test "$GXX" = "yes"
> +then
> +  CXX_FLAG_CHECK(NO_MAYBE_UNINITIALIZED, [-Wno-maybe-uninitialized])
> +  dnl gcc 4.7 introduced -Wmaybe-uninitialized to distinguish cases which
> are
> +  dnl known to be uninitialized from cases which might be uninitialized.
>  We
> +  dnl still want to catch the first kind of errors.
> +  if test "$NO_MAYBE_UNINITIALIZED" != "-Wno-maybe-uninitialized"
> +  then
> +    CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
> +  else
> +    dnl AC_SUBST doesn't work with empty strings.
> +    NO_UNINITIALIZED=
> +  fi
> +else
> +  NO_UNINITIALIZED=
> +  NO_MAYBE_UNINITIALIZED=
> +fi
> +AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS
> $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
> +
>
>
>  dnl===-----------------------------------------------------------------------===
>  dnl===
> --
> 1.7.8.4
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130109/35d54869/attachment.html>


More information about the llvm-commits mailing list