Subject: bug#78032: closed (Re: [bug-diffutils] bug#78032: new compilation error)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 28 Apr 2025 06:46:01 +0000

Your bug report

#78032: new compilation error

which was filed against the diffutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78032: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78032
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug-diffutils] bug#78032: new compilation error
From: Paul Eggert <[email-masked]>
To: Bruno Haible <[email-masked]>
Cc: [email-masked]
Date: Sun, 27 Apr 2025 23:44:57 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 2025-04-24 03:57, Bruno Haible via bug-diffutils via All diffutils 
discussion. wrote:
> ../../src/sdiff.c: In function 'edit':
> ../../src/sdiff.c:884:8: error: a label can only be part of a statement and a declaration is not a statement
>          int cmd1 = skip_white ();

Thanks for reporting that. I installed the attached to fix it.

From 686357a40ca038edc902276cb3b33f4757d8cfb2 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 26 Apr 2025 12:54:06 -0700
Subject: [PATCH] sdiff: port back to C17-

* src/sdiff.c (edit): Do not use a label just before a statement.
Problem reported by Bruno Haible (Bug#78032).
---
 src/sdiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sdiff.c b/src/sdiff.c
index 15b8dce..cc961c3 100644
--- a/src/sdiff.c
+++ b/src/sdiff.c
@@ -880,7 +880,7 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen,
                 }
               break;
 
-            case 'e':
+	    case 'e':;
 	      int cmd1 = skip_white ();
               switch (cmd1)
                 {
-- 
2.48.1

Subject: new compilation error
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Thu, 24 Apr 2025 12:57:02 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Paul,

The CI reports a compilation error of GNU diffutils, caused by the
most recent commit 45a4762bf3241e7fb6a2e01d382791ae44236841 .

Error seen on CentOS 7 (with gcc):

../../src/sdiff.c: In function 'edit':
../../src/sdiff.c:884:8: error: a label can only be part of a statement and a declaration is not a statement
        int cmd1 = skip_white ();
        ^
make[2]: *** [sdiff.o] Error 1

Errors seen on macOS 15 and FreeBSD (with clang):

../../src/sdiff.c:884:8: error: expected expression
  884 |               int cmd1 = skip_white ();
      |               ^
../../src/sdiff.c:885:23: error: use of undeclared identifier 'cmd1'; did you mean 'cmd'?
  885 |               switch (cmd1)
      |                       ^~~~
      |                       cmd
...

Bruno