aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-04 12:07:26 +0400
committerDmitry Antipov2012-07-04 12:07:26 +0400
commit8ce70ed205e01913845330d084b9dd793b66d2c6 (patch)
tree460d38b6d758a660b0fe2c02557f94ce40539496
parent24a212eb232e081c12f6b52429757657f0528e66 (diff)
downloademacs-8ce70ed205e01913845330d084b9dd793b66d2c6.tar.gz
emacs-8ce70ed205e01913845330d084b9dd793b66d2c6.zip
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.
-rw-r--r--ChangeLog5
-rw-r--r--configure.in6
-rw-r--r--src/ChangeLog9
-rw-r--r--src/doprnt.c3
-rw-r--r--src/search.c3
5 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index db3dc32410d..95f0f0c1a20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * configure.in: If --enable-gcc-warnings, disable
4 -Wunsafe-loop-optimizations for -O1 optimization level.
5
12012-06-30 Glenn Morris <rgm@gnu.org> 62012-06-30 Glenn Morris <rgm@gnu.org>
2 7
3 * configure.in (standardlisppath): New output variable. 8 * configure.in (standardlisppath): New output variable.
diff --git a/configure.in b/configure.in
index 20b4cf2d593..dde8bcca855 100644
--- a/configure.in
+++ b/configure.in
@@ -681,6 +681,12 @@ else
681 nw="$nw -Wsuggest-attribute=const" 681 nw="$nw -Wsuggest-attribute=const"
682 nw="$nw -Wsuggest-attribute=pure" 682 nw="$nw -Wsuggest-attribute=pure"
683 683
684 # Some loops can't be optimized with -O1,
685 # so remove -Wunsafe-loop-optimizations.
686 if echo "$CFLAGS" | $EGREP 'O1' 1>/dev/null; then
687 nw="$nw -Wunsafe-loop-optimizations"
688 fi
689
684 gl_MANYWARN_ALL_GCC([ws]) 690 gl_MANYWARN_ALL_GCC([ws])
685 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) 691 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
686 for w in $ws; do 692 for w in $ws; do
diff --git a/src/ChangeLog b/src/ChangeLog
index e335c8de8d4..065ff35ce77 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Fix compilation with --enable-gcc-warnings and -O1
4 optimization level.
5 * doprnt.c (doprnt): Change type of tem to int, initialize
6 to avoid compiler warning. Add eassert.
7 * search.c (simple_search): Initialize match_byte to avoid
8 compiler warning. Add eassert.
9
12012-07-04 Paul Eggert <eggert@cs.ucla.edu> 102012-07-04 Paul Eggert <eggert@cs.ucla.edu>
2 11
3 Avoid weird behavior with large horizontal scrolls. 12 Avoid weird behavior with large horizontal scrolls.
diff --git a/src/doprnt.c b/src/doprnt.c
index 07bbcff7081..707dd0648b5 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -150,7 +150,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
150 /* Buffer we have got with malloc. */ 150 /* Buffer we have got with malloc. */
151 char *big_buffer = NULL; 151 char *big_buffer = NULL;
152 152
153 register size_t tem; 153 register int tem = -1;
154 char *string; 154 char *string;
155 char fixed_buffer[20]; /* Default buffer for small formatting. */ 155 char fixed_buffer[20]; /* Default buffer for small formatting. */
156 char *fmtcpy; 156 char *fmtcpy;
@@ -368,6 +368,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
368 368
369 /* Copy string into final output, truncating if no room. */ 369 /* Copy string into final output, truncating if no room. */
370 doit: 370 doit:
371 eassert (tem != -1);
371 /* Coming here means STRING contains ASCII only. */ 372 /* Coming here means STRING contains ASCII only. */
372 if (STRING_BYTES_BOUND < tem) 373 if (STRING_BYTES_BOUND < tem)
373 error ("Format width or precision too large"); 374 error ("Format width or precision too large");
diff --git a/src/search.c b/src/search.c
index 4912c0f23ec..11f51d87a7d 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
1451 int forward = n > 0; 1451 int forward = n > 0;
1452 /* Number of buffer bytes matched. Note that this may be different 1452 /* Number of buffer bytes matched. Note that this may be different
1453 from len_byte in a multibyte buffer. */ 1453 from len_byte in a multibyte buffer. */
1454 ptrdiff_t match_byte; 1454 ptrdiff_t match_byte = PTRDIFF_MIN;
1455 1455
1456 if (lim > pos && multibyte) 1456 if (lim > pos && multibyte)
1457 while (n > 0) 1457 while (n > 0)
@@ -1622,6 +1622,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
1622 stop: 1622 stop:
1623 if (n == 0) 1623 if (n == 0)
1624 { 1624 {
1625 eassert (match_byte != PTRDIFF_MIN);
1625 if (forward) 1626 if (forward)
1626 set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte); 1627 set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte);
1627 else 1628 else