diff options
| author | Dmitry Antipov | 2012-07-04 12:07:26 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-04 12:07:26 +0400 |
| commit | 8ce70ed205e01913845330d084b9dd793b66d2c6 (patch) | |
| tree | 460d38b6d758a660b0fe2c02557f94ce40539496 /src | |
| parent | 24a212eb232e081c12f6b52429757657f0528e66 (diff) | |
| download | emacs-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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/doprnt.c | 3 | ||||
| -rw-r--r-- | src/search.c | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e335c8de8d4..065ff35ce77 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-07-04 Paul Eggert <eggert@cs.ucla.edu> | 10 | 2012-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 |