bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mountlist: Use recommended syntax for _GL_UNUSED_LABEL


From: Bruno Haible
Subject: mountlist: Use recommended syntax for _GL_UNUSED_LABEL
Date: Sun, 22 Aug 2021 22:26:38 +0200

A semicolon is expected after _GL_UNUSED_LABEL, at least in C++ mode. See:

================================ foo.c ================================
int foo (int x)
{
  x += 2;
  if (x & 1)
    goto a;
b:
  __attribute__ ((__unused__))
  {
    x *= 3;
  }
a:
  return x;
}
=======================================================================

$ gcc -Wall -S foo.c
$ clang -Wall -S foo.c
$ gcc -Wall -S -x c++ foo.c
foo.c: In function 'int foo(int)':
foo.c:8:3: error: expected primary-expression before '{' token
    8 |   {
      |   ^
foo.c:6:1: warning: label 'b' defined but not used [-Wunused-label]
    6 | b:
      | ^
$ clang -Wall -S -x c++ foo.c
foo.c:8:3: error: expected ';' after __attribute__
  {
  ^
1 error generated.

Therefore, don't set a bad precedent by writing _GL_UNUSED_LABEL without
semicolon, even in C-only code.


2021-08-22  Bruno Haible  <bruno@clisp.org>

        mountlist: Use recommended syntax for _GL_UNUSED_LABEL.
        * lib/mountlist.c (read_file_system_list): Add semicolon after
        _GL_UNUSED_LABEL.

diff --git a/lib/mountlist.c b/lib/mountlist.c
index adc8740bf..352b35f35 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -1089,7 +1089,7 @@ read_file_system_list (bool need_fs_type)
   return mount_list;
 
 
- free_then_fail: _GL_UNUSED_LABEL
+ free_then_fail: _GL_UNUSED_LABEL;
   {
     int saved_errno = errno;
     *mtail = NULL;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]