[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/17] maint: modernize IF_LINT for GCC 11.2.1
From: |
Paul Eggert |
Subject: |
[PATCH 11/17] maint: modernize IF_LINT for GCC 11.2.1 |
Date: |
Sun, 22 Aug 2021 14:03:00 -0700 |
* src/cmp.c (cmp):
* src/dir.c (find_dir_file_pathname):
* src/sdiff.c (edit):
Mention which GCC bug this IF_LINT works around.
* src/diff3.c (process_diff):
Always initialize to NULL, to avoid problems on mostly-theoretical
hosts where accessing uninitialized variables traps. The next
patch will have a better fix for this.
* src/ifdef.c (do_printf_spec):
No need for IF_LINT in GCC 11.2.1.
---
src/cmp.c | 2 +-
src/diff3.c | 2 +-
src/dir.c | 5 +----
src/ifdef.c | 2 +-
src/sdiff.c | 4 ++--
5 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/cmp.c b/src/cmp.c
index 9953d14..2e89ac1 100644
--- a/src/cmp.c
+++ b/src/cmp.c
@@ -390,7 +390,7 @@ cmp (void)
char *buf1 = (char *) buffer1;
int differing = 0;
int f;
- int offset_width IF_LINT (= 0);
+ int offset_width IF_LINT (= 0); /* IF_LINT due to GCC bug 101768. */
if (comparison_type == type_all_diffs)
{
diff --git a/src/diff3.c b/src/diff3.c
index 09d987f..ccb7809 100644
--- a/src/diff3.c
+++ b/src/diff3.c
@@ -1009,7 +1009,7 @@ process_diff (char const *filea,
lin i;
struct diff_block *block_list;
struct diff_block **block_list_end = &block_list;
- struct diff_block *bptr IF_LINT (= NULL);
+ struct diff_block *bptr = NULL;
size_t too_many_lines = (PTRDIFF_MAX
/ MIN (sizeof *bptr->lines[1],
sizeof *bptr->lengths[1]));
diff --git a/src/dir.c b/src/dir.c
index 01a32ab..3ffb953 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -339,10 +339,7 @@ dir_loop (struct comparison const *cmp, int i)
char *
find_dir_file_pathname (char const *dir, char const *file)
{
- /* The 'IF_LINT (volatile)' works around what appears to be a bug in
- gcc 4.8.0 20120825; see
- <http://lists.gnu.org/archive/html/bug-diffutils/2012-08/msg00007.html>.
- */
+ /* IF_LINT due to GCC bug 21161. */
char const * IF_LINT (volatile) match = file;
char *val;
diff --git a/src/ifdef.c b/src/ifdef.c
index 5a000cb..d82d2d1 100644
--- a/src/ifdef.c
+++ b/src/ifdef.c
@@ -329,7 +329,7 @@ do_printf_spec (FILE *out, char const *spec,
return 0;
else
{
- char value IF_LINT (= 0);
+ char value;
f = scan_char_literal (f, &value);
if (!f)
return 0;
diff --git a/src/sdiff.c b/src/sdiff.c
index cc20dac..11e4da9 100644
--- a/src/sdiff.c
+++ b/src/sdiff.c
@@ -866,8 +866,8 @@ edit (struct line_filter *left, char const *lname, lin
lline, lin llen,
{
for (;;)
{
- int cmd0 IF_LINT (= 0);
- int cmd1 IF_LINT (= 0);
+ int cmd0;
+ int cmd1 IF_LINT (= 0); /* IF_LINT due to GCC bug 101770. */
bool gotcmd = false;
while (! gotcmd)
--
2.31.1
- [PATCH 08/17] diff: remove INT_MAX limit on -F/-p searches, (continued)
- [PATCH 08/17] diff: remove INT_MAX limit on -F/-p searches, Paul Eggert, 2021/08/22
- [PATCH 03/17] diff3: suppress -fanalyzer alarms, Paul Eggert, 2021/08/22
- [PATCH 16/17] maint: refactor integer overflow checking, Paul Eggert, 2021/08/22
- [PATCH 04/17] maint: zalloc → xzalloc, Paul Eggert, 2021/08/22
- [PATCH 13/17] sdiff: fix unlikely memory leak, Paul Eggert, 2021/08/22
- [PATCH 02/17] maint: remove January workaround for Gnulib issue, Paul Eggert, 2021/08/22
- [PATCH 17/17] diff: add integer overflow checking, Paul Eggert, 2021/08/22
- [PATCH 10/17] maint: lint → GCC_LINT, Paul Eggert, 2021/08/22
- [PATCH 05/17] maint: remove prepargs, Paul Eggert, 2021/08/22
- [PATCH 07/17] maint: .gitignore updates, Paul Eggert, 2021/08/22
- [PATCH 11/17] maint: modernize IF_LINT for GCC 11.2.1,
Paul Eggert <=
- [PATCH 15/17] diff: avoid sprintf %s, Paul Eggert, 2021/08/22