bugGNU gettext - Bugs: bug #63866, error: expected expression

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #63866: error: expected expression

Submitter:  Ryan Carsten Schmidt <ryandesign>
Submitted:  Sat 04 Mar 2023 09:00:21 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Jump to the original submission

Thu 22 Feb 2024 01:41:13 AM UTC, comment #8: 

The fix is contained in gettext 0.22.5.

Bruno Haible <haible>
Group administrator
Mon 29 Jan 2024 05:28:59 PM UTC, comment #7: 
Bruno Haible <haible>
Group administrator
Mon 29 Jan 2024 03:59:42 PM UTC, comment #6: 

The gnulib build results I posted on Jan 26 were not from OS X 10.9 so I'm not sure why I posted them. I think I was using OS X 10.11 which does not have the affected clang version.

I tried your latest gnulib tarball on OS X 10.9. ./configure and make succeeded. make test failed one test, test-fma2, but I don't think that's related to this issue.

gettext 0.22.4 still fails to build on OS X 10.9 with the error I originally reported. Here is the first error and a warning; there are many more warnings but as you said we're not as concerned with the warnings:


x-c.c:1561:15: error: expected expression
              FALLTHROUGH;
              ^
../libgrep/attribute.h:165:21: note: expanded from macro 'FALLTHROUGH'
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
                    ^
../config.h:3211:37: note: expanded from macro '_GL_ATTRIBUTE_FALLTHROUGH'
#  define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
                                    ^
x-c.c:1676:15: warning: declaration does not declare anything [-Wmissing-declarations]
              FALLTHROUGH;
              ^~~~~~~~~~~
../libgrep/attribute.h:165:21: note: expanded from macro 'FALLTHROUGH'
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
                    ^~~~~~~~~~~~~~~~~~~~~~~~~
../config.h:3211:37: note: expanded from macro '_GL_ATTRIBUTE_FALLTHROUGH'
#  define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
                                    ^~~~~~~~~~~~~


Here's how I fixed it in MacPorts:

https://github.com/macports/macports-ports/blob/ee9941bcea5a4d7a43f3c88d43c2aa4975520b51/devel/gettext/files/has_attribute.patch

Ryan Carsten Schmidt <ryandesign>
Fri 26 Jan 2024 11:22:25 PM UTC, comment #5: 


> I don't think it has been fixed in that version of gnulib.


To me, it looks fixed: the "error: expected expression: does not appear. The errors in the C++ source files can be ignored here; they are more like a perfectionist's torture test.

So, if "make -k" completes without errors in C source files, it's fine.

Alternatively, I created a new https://haible.de/bruno/gnu/testdir-all.tar.gz today, without C++ source files. If this tarball compiles without errors, it's fine.

The warnings can be ignored. We cannot achieve a warning-free build on all platforms.

Bruno Haible <haible>
Group administrator
Fri 26 Jan 2024 03:21:16 PM UTC, comment #4: 

I don't think it has been fixed in that version of gnulib.

These warnings occur while building gnulib:


unistr/u8-uctomb-aux.c:53:7: warning: declaration does not declare anything [-Wmissing-declarations]
      FALLTHROUGH;
      ^~~~~~~~~~~
./attribute.h:150:21: note: expanded from macro 'FALLTHROUGH'
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
                    ^~~~~~~~~~~~~~~~~~~~~~~~~


and then the build fails with:


test-assert-h-c++.cc:30:26: error: too few arguments provided to function-like macro invocation
static_assert (2 + 2 == 4);
                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:497:9: note: macro
      'static_assert' defined here
#define static_assert(__b, __m) \
        ^
test-assert-h-c++.cc:30:1: error: C++ requires a type specifier for all declarations
static_assert (2 + 2 == 4);
^~~~~~~~~~~~~
2 errors generated.


Ryan Carsten Schmidt <ryandesign>
Sat 04 Mar 2023 08:48:39 PM UTC, comment #3: 

Thanks for the report.

You have found the relevant corrections that happened so far in the gnulib git history.

We have only found recently how to translate LLVM versions from/to Apple clang versions, namely through this table: https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2

The next versions of GNU gettext will also use more recent versions of gnulib.

The most relevant question is therefore: Is the issue fixed in the current gnulib? To answer this question, please could you download
https://haible.de/bruno/gnu/testdir-all.tar.gz
and build it through

./configure
make
make check


Thanks!

Bruno Haible <haible>
Group administrator
Sat 04 Mar 2023 09:52:09 AM UTC, comment #2: 

For gettext 0.21 we were applying patches to fix `_GL_HAS_ATTRIBUTE`:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=605e20a698d3f7296cda18ac7dd84b1a8f388b50

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d125d4f6d1a5d9845824aaf1d1c9dc69699bf2f1

When updating to gettext 0.21.1 I removed those patches because they were already included. But maybe it's not using exactly the right version of Apple clang as a cutoff for whether or not `__has_attribute` works.

The first commit references the LLVM 3.5.0 release notes saying that `__has_attribute` is unreliable in earlier versions and so the first commit excludes clang versions earlier than 3.5.0. Fine. The next commit then adds code to handle Apple clang's different versioning, excluding Apple clang versions with `__apple_build_version__` < 6000000. The problem is there is not an exact correspondence between Apple clang and non-Apple clang versions. Apple clang versions are based on some intermediate stage of non-Apple clang development. For example Apple clang 6.0 is "based on LLVM 3.5svn", so some point before the LLVM 3.5.0 release—perhaps a point before they had fixed `__has_attribute`. Apple clang 6.1.0 was "based on LLVM 3.6.0svn" so that would surely include the `__has_attribute` fix. Now to find the value of `__apple_build_version__` for Apple clang 6.1.0 (or you could just check `__clang_major__` and `__clang_minor__`).

Ryan Carsten Schmidt <ryandesign>
Sat 04 Mar 2023 09:26:04 AM UTC, comment #1: 

This is a new problem in gettext 0.21.1. 0.21 built fine.

For now, I've worked around the problem by using a different compiler (non-Apple clang 3.7) to build it.

Ryan Carsten Schmidt <ryandesign>
Sat 04 Mar 2023 09:00:21 AM UTC, original submission:  

gettext fails to build on OS X 10.9 with Xcode v6.2's Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn).

https://build.macports.org/builders/ports-10.9_x86_64-builder/builds/222301/steps/install-port/logs/stdio


x-c.c:1486:7: warning: declaration does not declare anything [-Wmissing-declarations]
      FALLTHROUGH;
      ^~~~~~~~~~~
../libgrep/attribute.h:150:21: note: expanded from macro 'FALLTHROUGH'
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
                    ^~~~~~~~~~~~~~~~~~~~~~~~~
../config.h:2844:36: note: expanded from macro '_GL_ATTRIBUTE_FALLTHROUGH'
# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
                                   ^~~~~~~~~~~~~
x-c.c:1509:15: error: expected expression
              FALLTHROUGH;
              ^
../libgrep/attribute.h:150:21: note: expanded from macro 'FALLTHROUGH'
#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
                    ^
../config.h:2844:36: note: expanded from macro '_GL_ATTRIBUTE_FALLTHROUGH'
# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
                                   ^


It builds fine with later and earlier macOS / Apple clang versions.

I reported the same problem in neovim some years ago; see https://github.com/neovim/neovim/issues/10125 for the report and how they fixed it.

Ryan Carsten Schmidt <ryandesign>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by ryandesign (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-22 haible StatusFixed Fix Released
    2024-01-29 haible StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2023-03-04 haible StatusNone Need Info
        Assigned toNone haible

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code