[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Turning off pointer signedness warnings (patch)
From: |
Chong Yidong |
Subject: |
Turning off pointer signedness warnings (patch) |
Date: |
Fri, 30 Dec 2005 16:32:34 -0500 |
GCC 4.0 warns when a pointer to an unsigned object is passed to a
function that takes pointers to signed objects (or vice versa). In
older GCC's, this was a -pedantic warning; now, it's turned on by
default. (http://gcc.gnu.org/ml/gcc/2004-12/msg00841.html)
Unfortunately, this practice occurs rather often in the Emacs sources.
During compilation, the warning is issued hundreds of times, making it
very difficult to spot *real* compiler warnings.
The following patch makes use of the new -Wno-pointer-sign option,
whenever it is available. If there are no objections, I'll check it
in soon.
*** emacs/configure.in.~1.402.~ 2005-12-30 14:44:49.000000000 -0500
--- emacs/configure.in 2005-12-30 16:15:36.000000000 -0500
***************
*** 1261,1266 ****
--- 1261,1279 ----
CC="$CC $NON_GCC_TEST_OPTIONS"
fi
+ ### Use -Wno-pointer-sign if the compiler supports it
+ AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wno-pointer-sign"
+ AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
+ if test $has_option = yes; then
+ C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
+ fi
+ AC_MSG_RESULT($has_option)
+ CFLAGS="$SAVE_CFLAGS"
+ unset has_option
+ unset SAVE_CFLAGS
+
#### Some other nice autoconf tests.
dnl checks for programs
***************
*** 1394,1399 ****
--- 1407,1416 ----
#endif
#endif
+ #ifndef C_WARNINGS_SWITCH
+ #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
+ #endif
+
#ifndef LD_SWITCH_MACHINE
#define LD_SWITCH_MACHINE
#endif
***************
*** 1422,1428 ****
/* Get the CFLAGS for real compilation. */
#ifdef __GNUC__
! configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH
'${SPECIFIED_CFLAGS}'
#else
configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
#endif
--- 1439,1445 ----
/* Get the CFLAGS for real compilation. */
#ifdef __GNUC__
! configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH
'${SPECIFIED_CFLAGS}'
#else
configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
#endif
- Turning off pointer signedness warnings (patch),
Chong Yidong <=