Commit 131d2d2e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

configure: Use -Winit-self if possible.

This protects against variable initialization like "int x = x". gcc apparently treats this as an intentional way to suppress uninitialized or unused variable warnings, but in my case it has caused at least one confusing bug. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5a3b5c96
......@@ -9982,6 +9982,37 @@ $as_echo "$ac_cv_crosscflags__Wignored_qualifiers" >&6; }
if test "x$ac_cv_crosscflags__Wignored_qualifiers" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wignored-qualifiers"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Winit-self" >&5
$as_echo_n "checking whether the cross-compiler supports -Winit-self... " >&6; }
if ${ac_cv_crosscflags__Winit_self+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
ac_wine_try_cflags_saved_cc=$CC
ac_wine_try_cflags_saved_exeext=$ac_exeext
CFLAGS="$CFLAGS $EXTRACROSSCFLAGS -nostartfiles -nodefaultlibs -Winit-self"
CC="$CROSSCC"
ac_exeext=".exe"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int __cdecl mainCRTStartup(void) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_crosscflags__Winit_self=yes
else
ac_cv_crosscflags__Winit_self=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
CC=$ac_wine_try_cflags_saved_cc
ac_exeext=$ac_wine_try_cflags_saved_exeext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_crosscflags__Winit_self" >&5
$as_echo "$ac_cv_crosscflags__Winit_self" >&6; }
if test "x$ac_cv_crosscflags__Winit_self" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Winit-self"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Wpacked-not-aligned" >&5
$as_echo_n "checking whether the cross-compiler supports -Wpacked-not-aligned... " >&6; }
if ${ac_cv_crosscflags__Wpacked_not_aligned+:} false; then :
......@@ -17194,6 +17225,31 @@ $as_echo "$ac_cv_cflags__Wignored_qualifiers" >&6; }
if test "x$ac_cv_cflags__Wignored_qualifiers" = xyes; then :
EXTRACFLAGS="$EXTRACFLAGS -Wignored-qualifiers"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Winit-self" >&5
$as_echo_n "checking whether the compiler supports -Winit-self... " >&6; }
if ${ac_cv_cflags__Winit_self+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Winit-self"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Winit_self=yes
else
ac_cv_cflags__Winit_self=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Winit_self" >&5
$as_echo "$ac_cv_cflags__Winit_self" >&6; }
if test "x$ac_cv_cflags__Winit_self" = xyes; then :
EXTRACFLAGS="$EXTRACFLAGS -Winit-self"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wpacked-not-aligned" >&5
$as_echo_n "checking whether the compiler supports -Wpacked-not-aligned... " >&6; }
if ${ac_cv_cflags__Wpacked_not_aligned+:} false; then :
......
......@@ -1044,6 +1044,7 @@ then
WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CROSSCFLAGS([-Wempty-body])
WINE_TRY_CROSSCFLAGS([-Wignored-qualifiers])
WINE_TRY_CROSSCFLAGS([-Winit-self])
WINE_TRY_CROSSCFLAGS([-Wpacked-not-aligned],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-packed-not-aligned"])
WINE_TRY_CROSSCFLAGS([-Wpragma-pack],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-pragma-pack"])
WINE_TRY_CROSSCFLAGS([-Wshift-overflow=2])
......@@ -2024,6 +2025,7 @@ then
WINE_TRY_CFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CFLAGS([-Wempty-body])
WINE_TRY_CFLAGS([-Wignored-qualifiers])
WINE_TRY_CFLAGS([-Winit-self])
WINE_TRY_CFLAGS([-Wpacked-not-aligned],[EXTRACFLAGS="$EXTRACFLAGS -Wno-packed-not-aligned"])
WINE_TRY_CFLAGS([-Wpragma-pack],[EXTRACFLAGS="$EXTRACFLAGS -Wno-pragma-pack"])
WINE_TRY_CFLAGS([-Wshift-overflow=2])
......
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