configure: check for -Wpointer-sign and turn it off
Mike McCormack
mike at codeweavers.com
Fri Jul 1 13:09:58 CDT 2005
gcc with -Wpointer-sign enabled by default spits out alot of useless
errors when compiling Wine. Turn it off if we find it.
Mike
ChangeLog:
* check for -Wpointer-sign and turn it off
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.370
diff -u -p -r1.370 configure.ac
--- configure.ac 30 Jun 2005 20:46:59 -0000 1.370
+++ configure.ac 1 Jul 2005 09:02:10 -0000
@@ -837,6 +837,32 @@ int main(void) {
then
EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
fi
+
+ dnl Check for -Wpointer-sign turned on by default
+ dnl Wine causes alot of these warnings
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_CACHE_CHECK([for -Wpointer-sign warnings], ac_cv_c_pointer_sign_warnings,
+ AC_TRY_COMPILE([ void a(char*b) { *b = 0; }
+ void c(unsigned char*d) { a( d ); } ],[],
+ [ac_cv_c_pointer_sign_warnings=no],[ac_cv_c_pointer_sign_warnings=yes]))
+ CFLAGS="$saved_CFLAGS"
+
+ dnl Try to use -Wno-pointer-sign to turn off the warnings
+ if test "$ac_cv_c_pointer_sign_warnings" = "yes"
+ then
+ CFLAGS="$CFLAGS -Wno-pointer-sign -Werror"
+ AC_CACHE_CHECK([for -Wno-pointer-sign flag], ac_cv_c_no_pointer_sign,
+ AC_TRY_COMPILE([ void a(char*b) { *b = 0; }
+ void c(unsigned char*d) { a( d ); } ],[],
+ [ac_cv_c_no_pointer_sign=yes],[ac_cv_c_no_pointer_sign=no]))
+ CFLAGS="$saved_CFLAGS"
+ if test "$ac_cv_c_no_pointer_sign" = "yes"
+ then
+ CFLAGS="$CFLAGS -Wno-pointer-sign"
+ fi
+ echo CFLAGS="$CFLAGS -Wno-pointer-sign"
+ fi
fi
dnl **** Check how to define a function in assembly code ****
More information about the wine-patches
mailing list