all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Subject: Turning off pointer signedness warnings (patch)
Date: Fri, 30 Dec 2005 16:32:34 -0500	[thread overview]
Message-ID: <87fyoaclu5.fsf@stupidchicken.com> (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

             reply	other threads:[~2005-12-30 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-30 21:32 Chong Yidong [this message]
2005-12-31  9:07 ` Turning off pointer signedness warnings (patch) Eli Zaretskii
2005-12-31 15:10   ` Chong Yidong
2005-12-31 17:40 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fyoaclu5.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.