GNU bug report logs - #41348
emacs compilation with clang10 fails in the file lib-src/etags.c

Previous Next

Package: emacs;

Reported by: Narayanan Nellayi <n.a.narayanan <at> gmail.com>

Date: Sun, 17 May 2020 08:30:02 UTC

Severity: normal

Tags: fixed, patch

Done: Tom Tromey <tom <at> tromey.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41348 in the body.
You can then email your comments to 41348 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41348; Package emacs. (Sun, 17 May 2020 08:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Narayanan Nellayi <n.a.narayanan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 17 May 2020 08:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Narayanan Nellayi <n.a.narayanan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: "Narayanan N.A." <n.a.narayanan <at> gmail.com>
Subject: emacs compilation with clang10 fails in the file lib-src/etags.c
Date: Sun, 17 May 2020 12:32:39 +0530
[Message part 1 (text/plain, inline)]
Hi,

emacs compilation with clang10 on Ubuntu 20.04 (focal release) fails with
an error in the file lib-src/etags.c. I am able to fix the issue with a
one-line change. This compilation failure is seen on the emacs src from
top-of-the-master-branch.

Pls see if this fix is appropriate and consider accordingly.

I have given below the details on the issue and a patch description.

Regards
Narayanan

clang --version
> clang version 10.0.0-4ubuntu1
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
>


> make -C lib-src all
> make[1]: Entering directory
> '/mnt/myvg_fs/home/anarayan/sources/emacs/lib-src'
>   CCLD     etags
> error: fallthrough annotation does not directly precede switch label
> 1 error generated.
> make[1]: *** [Makefile:366: etags] Error 1
> make[1]: Leaving directory
> '/mnt/myvg_fs/home/anarayan/sources/emacs/lib-src'
> make: *** [Makefile:411: lib-src] Error 2
>


> diff --git a/lib-src/etags.c b/lib-src/etags.c
> index eee2c59626..b5f077007b 100644
> --- a/lib-src/etags.c
> +++ b/lib-src/etags.c
> @@ -4196,7 +4196,7 @@ C_entries (int c_ext, FILE *inf)
>        objdef = omethodsign;
>        break;
>      }
> -  FALLTHROUGH;
> +  // FALLTHROUGH;
>   resetfvdef:
>   case '#': case '~': case '&': case '%': case '/':
>   case '|': case '^': case '!': case '.': case '?':
>

>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41348; Package emacs. (Sun, 17 May 2020 15:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 41348 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Narayanan Nellayi <n.a.narayanan <at> gmail.com>
Cc: 41348 <at> debbugs.gnu.org
Subject: Re: bug#41348: emacs compilation with clang10 fails in the file
 lib-src/etags.c
Date: Sun, 17 May 2020 18:24:11 +0300
> From: Narayanan Nellayi <n.a.narayanan <at> gmail.com>
> Date: Sun, 17 May 2020 12:32:39 +0530
> Cc: "Narayanan N.A." <n.a.narayanan <at> gmail.com>
> 
> emacs compilation with clang10 on Ubuntu 20.04 (focal release) fails with an error in the file lib-src/etags.c.
> I am able to fix the issue with a one-line change. This compilation failure is seen on the emacs src from
> top-of-the-master-branch.
> 
> Pls see if this fix is appropriate and consider accordingly.

Does this mean Clang doesn't support __attribute__ ((__fallthrough__))?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41348; Package emacs. (Sun, 17 May 2020 15:38:01 GMT) Full text and rfc822 format available.

Message #11 received at 41348 <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Narayanan Nellayi <n.a.narayanan <at> gmail.com>, 41348 <at> debbugs.gnu.org
Subject: Re: bug#41348: emacs compilation with clang10 fails in the file
 lib-src/etags.c
Date: Sun, 17 May 2020 17:36:57 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii writes:
> Does this mean Clang doesn't support __attribute__ ((__fallthrough__))?

It looks to like it does support it.  But it complains, that there is a
non-switch label "resetfvdef:" (for goto) between the annotation and the
next "case".  The correct fix is probably to move "resetfvdef:" after
the "case" labels.

[patch (text/x-patch, inline)]
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 174c33a7a5..5eb7504e67 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -4196,9 +4196,9 @@ C_entries (int c_ext, FILE *inf)
 	      break;
 	    }
 	  FALLTHROUGH;
-	resetfvdef:
 	case '#': case '~': case '&': case '%': case '/':
 	case '|': case '^': case '!': case '.': case '?':
+	resetfvdef:
 	  if (definedef != dnone)
 	    break;
 	  /* These surely cannot follow a function tag in C. */
[Message part 3 (text/plain, inline)]
benny

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41348; Package emacs. (Sun, 17 May 2020 15:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 41348 <at> debbugs.gnu.org (full text, mbox):

From: Narayanan Nellayi <n.a.narayanan <at> gmail.com>
To: 41348 <at> debbugs.gnu.org
Cc: "Narayanan N.A." <n.a.narayanan <at> gmail.com>
Subject: emacs compilation with clang10 fails in the file lib-src/etags.c
Date: Sun, 17 May 2020 21:23:46 +0530
Hi,

The following patch also works; this is in case removal of a "break"
statement requires either a "FALLTHROUGH" or a"goto" statement. The
previous patch was to just comment out FALLTHROUGH and the other
alternative is to replace FALLTHROUGH with a goto, though using goto
to jump to the next statement looks odd.

> diff --git a/lib-src/etags.c b/lib-src/etags.c
> index eee2c59626..b3d4642505 100644
> --- a/lib-src/etags.c
> +++ b/lib-src/etags.c
> @@ -4196,7 +4196,8 @@ C_entries (int c_ext, FILE *inf)
>               objdef = omethodsign;
>               break;
>             }
> -         FALLTHROUGH;
> +         // FALLTHROUGH;
> +         goto resetfvdef;
>         resetfvdef:
>         case '#': case '~': case '&': case '%': case '/':
>         case '|': case '^': case '!': case '.': case '?':

Options I used to build emacs:

./configure 'CFLAGS=-Ofast -march=skylake -funroll-loops
-fno-finite-math-only' CC=clang   \
            --with-mailutils --with-sound=yes --with-x-toolkit=gtk3
                                               \
            --with-gconf --with-modules --with-file-notification=yes
                                               \
            --with-xwidgets --with-xaw3d=yes --with-libsystemd=yes
                                         \
            --with-imagemagick=yes

Regards
Narayanan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41348; Package emacs. (Sun, 17 May 2020 16:02:02 GMT) Full text and rfc822 format available.

Message #17 received at 41348 <at> debbugs.gnu.org (full text, mbox):

From: Narayanan Nellayi <n.a.narayanan <at> gmail.com>
To: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 41348 <at> debbugs.gnu.org
Subject: Re: bug#41348: emacs compilation with clang10 fails in the file
 lib-src/etags.c
Date: Sun, 17 May 2020 21:31:29 +0530
Hi Benny,

Thanks, what you suggested works and is cleaner than what I had in
mind (which is commenting out FALLTHROUGH or using a goto).

diff --git a/lib-src/etags.c b/lib-src/etags.c
index eee2c59626..4672e3491d 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -4197,9 +4197,9 @@ C_entries (int c_ext, FILE *inf)
              break;
            }
          FALLTHROUGH;
-       resetfvdef:
        case '#': case '~': case '&': case '%': case '/':
        case '|': case '^': case '!': case '.': case '?':
+       resetfvdef:
          if (definedef != dnone)
            break;
          /* These surely cannot follow a function tag in C. */

Thanks
Narayanan

On Sun, May 17, 2020 at 9:06 PM Benjamin Riefenstahl
<b.riefenstahl <at> turtle-trading.net> wrote:
>
> Eli Zaretskii writes:
> > Does this mean Clang doesn't support __attribute__ ((__fallthrough__))?
>
> It looks to like it does support it.  But it complains, that there is a
> non-switch label "resetfvdef:" (for goto) between the annotation and the
> next "case".  The correct fix is probably to move "resetfvdef:" after
> the "case" labels.
>
>
> benny




Added tag(s) fixed. Request was from Tom Tromey <tom <at> tromey.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 02:12:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 41348 <at> debbugs.gnu.org and Narayanan Nellayi <n.a.narayanan <at> gmail.com> Request was from Tom Tromey <tom <at> tromey.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 02:12:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Jun 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.