all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Turning off pointer signedness warnings (patch)
@ 2005-12-30 21:32 Chong Yidong
  2005-12-31  9:07 ` Eli Zaretskii
  2005-12-31 17:40 ` Richard M. Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Chong Yidong @ 2005-12-30 21:32 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Turning off pointer signedness warnings (patch)
  2005-12-30 21:32 Turning off pointer signedness warnings (patch) Chong Yidong
@ 2005-12-31  9:07 ` Eli Zaretskii
  2005-12-31 15:10   ` Chong Yidong
  2005-12-31 17:40 ` Richard M. Stallman
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2005-12-31  9:07 UTC (permalink / raw)
  Cc: emacs-devel

> From: Chong Yidong <cyd@stupidchicken.com>
> 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).

Yeah, a stupid warning, IMO.

> 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)

I think the GCC maintainers were convinced to make this off by default
in the next version of GCC.  This should make any changes in Emacs
unnecessary.

> 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.

Does this patch mean that even if I _want_ to use -Wpointer-sign, the
produced Makefile will prevent me from doing so?  If so, I object.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Turning off pointer signedness warnings (patch)
  2005-12-31  9:07 ` Eli Zaretskii
@ 2005-12-31 15:10   ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2005-12-31 15:10 UTC (permalink / raw)
  Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Does this patch mean that even if I _want_ to use -Wpointer-sign, the
> produced Makefile will prevent me from doing so?  If so, I object.

If you supply your own CFLAGS, the -Wno-pointer-sign disappears.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Turning off pointer signedness warnings (patch)
  2005-12-30 21:32 Turning off pointer signedness warnings (patch) Chong Yidong
  2005-12-31  9:07 ` Eli Zaretskii
@ 2005-12-31 17:40 ` Richard M. Stallman
  1 sibling, 0 replies; 4+ messages in thread
From: Richard M. Stallman @ 2005-12-31 17:40 UTC (permalink / raw)
  Cc: emacs-devel

    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)

The GCC developers told me that this will be reversed in the next
release.  Our complaints did win the day.

    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.

Please do, and thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-31 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-30 21:32 Turning off pointer signedness warnings (patch) Chong Yidong
2005-12-31  9:07 ` Eli Zaretskii
2005-12-31 15:10   ` Chong Yidong
2005-12-31 17:40 ` Richard M. Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.