emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108857: Fix compilation with --enabl


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108857: Fix compilation with --enable-gcc-warnings and -O1
Date: Wed, 04 Jul 2012 12:07:26 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108857
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-04 12:07:26 +0400
message:
  Fix compilation with --enable-gcc-warnings and -O1
  optimization level.
  * configure.in: If --enable-gcc-warnings, disable
  -Wunsafe-loop-optimizations for -O1 optimization level.
  * src/doprnt.c (doprnt): Change type of tem to int, initialize
  to avoid compiler warning.  Add eassert.
  * src/search.c (simple_search): Initialize match_byte to avoid
  compiler warning.  Add eassert.
modified:
  ChangeLog
  configure.in
  src/ChangeLog
  src/doprnt.c
  src/search.c
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-06-30 21:10:50 +0000
+++ b/ChangeLog 2012-07-04 08:07:26 +0000
@@ -1,3 +1,8 @@
+2012-07-04  Dmitry Antipov  <address@hidden>
+
+       * configure.in: If --enable-gcc-warnings, disable
+       -Wunsafe-loop-optimizations for -O1 optimization level.
+
 2012-06-30  Glenn Morris  <address@hidden>
 
        * configure.in (standardlisppath): New output variable.

=== modified file 'configure.in'
--- a/configure.in      2012-06-30 21:10:50 +0000
+++ b/configure.in      2012-07-04 08:07:26 +0000
@@ -681,6 +681,12 @@
   nw="$nw -Wsuggest-attribute=const"
   nw="$nw -Wsuggest-attribute=pure"
 
+  # Some loops can't be optimized with -O1,
+  # so remove -Wunsafe-loop-optimizations.
+  if echo "$CFLAGS" | $EGREP 'O1' 1>/dev/null; then
+    nw="$nw -Wunsafe-loop-optimizations"
+  fi
+
   gl_MANYWARN_ALL_GCC([ws])
   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
   for w in $ws; do

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-04 06:15:31 +0000
+++ b/src/ChangeLog     2012-07-04 08:07:26 +0000
@@ -1,3 +1,12 @@
+2012-07-04  Dmitry Antipov  <address@hidden>
+
+       Fix compilation with --enable-gcc-warnings and -O1
+       optimization level.
+       * doprnt.c (doprnt): Change type of tem to int, initialize
+       to avoid compiler warning.  Add eassert.
+       * search.c (simple_search): Initialize match_byte to avoid
+       compiler warning.  Add eassert.
+
 2012-07-04  Paul Eggert  <address@hidden>
 
        Avoid weird behavior with large horizontal scrolls.

=== modified file 'src/doprnt.c'
--- a/src/doprnt.c      2012-06-26 02:33:51 +0000
+++ b/src/doprnt.c      2012-07-04 08:07:26 +0000
@@ -150,7 +150,7 @@
   /* Buffer we have got with malloc.  */
   char *big_buffer = NULL;
 
-  register size_t tem;
+  register int tem = -1;
   char *string;
   char fixed_buffer[20];       /* Default buffer for small formatting. */
   char *fmtcpy;
@@ -368,6 +368,7 @@
 
              /* Copy string into final output, truncating if no room.  */
            doit:
+             eassert (tem != -1);
              /* Coming here means STRING contains ASCII only.  */
              if (STRING_BYTES_BOUND < tem)
                error ("Format width or precision too large");

=== modified file 'src/search.c'
--- a/src/search.c      2012-06-24 17:39:14 +0000
+++ b/src/search.c      2012-07-04 08:07:26 +0000
@@ -1451,7 +1451,7 @@
   int forward = n > 0;
   /* Number of buffer bytes matched.  Note that this may be different
      from len_byte in a multibyte buffer.  */
-  ptrdiff_t match_byte;
+  ptrdiff_t match_byte = PTRDIFF_MIN;
 
   if (lim > pos && multibyte)
     while (n > 0)
@@ -1622,6 +1622,7 @@
  stop:
   if (n == 0)
     {
+      eassert (match_byte != PTRDIFF_MIN);
       if (forward)
        set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte);
       else


reply via email to

[Prev in Thread] Current Thread [Next in Thread]