Commit 8ce70ed2 authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

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.
parent 24a212eb
2012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
* configure.in: If --enable-gcc-warnings, disable
-Wunsafe-loop-optimizations for -O1 optimization level.
2012-06-30 Glenn Morris <rgm@gnu.org> 2012-06-30 Glenn Morris <rgm@gnu.org>
* configure.in (standardlisppath): New output variable. * configure.in (standardlisppath): New output variable.
......
...@@ -681,6 +681,12 @@ else ...@@ -681,6 +681,12 @@ else
nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=const"
nw="$nw -Wsuggest-attribute=pure" 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_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do for w in $ws; do
......
2012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
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 <eggert@cs.ucla.edu> 2012-07-04 Paul Eggert <eggert@cs.ucla.edu>
Avoid weird behavior with large horizontal scrolls. Avoid weird behavior with large horizontal scrolls.
......
...@@ -150,7 +150,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, ...@@ -150,7 +150,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
/* Buffer we have got with malloc. */ /* Buffer we have got with malloc. */
char *big_buffer = NULL; char *big_buffer = NULL;
register size_t tem; register int tem = -1;
char *string; char *string;
char fixed_buffer[20]; /* Default buffer for small formatting. */ char fixed_buffer[20]; /* Default buffer for small formatting. */
char *fmtcpy; char *fmtcpy;
...@@ -368,6 +368,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, ...@@ -368,6 +368,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
/* Copy string into final output, truncating if no room. */ /* Copy string into final output, truncating if no room. */
doit: doit:
eassert (tem != -1);
/* Coming here means STRING contains ASCII only. */ /* Coming here means STRING contains ASCII only. */
if (STRING_BYTES_BOUND < tem) if (STRING_BYTES_BOUND < tem)
error ("Format width or precision too large"); error ("Format width or precision too large");
......
...@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat, ...@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
int forward = n > 0; int forward = n > 0;
/* Number of buffer bytes matched. Note that this may be different /* Number of buffer bytes matched. Note that this may be different
from len_byte in a multibyte buffer. */ from len_byte in a multibyte buffer. */
ptrdiff_t match_byte; ptrdiff_t match_byte = PTRDIFF_MIN;
if (lim > pos && multibyte) if (lim > pos && multibyte)
while (n > 0) while (n > 0)
...@@ -1622,6 +1622,7 @@ simple_search (EMACS_INT n, unsigned char *pat, ...@@ -1622,6 +1622,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
stop: stop:
if (n == 0) if (n == 0)
{ {
eassert (match_byte != PTRDIFF_MIN);
if (forward) if (forward)
set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte); set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte);
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment