[Rpm-maint] [rpm-software-management/rpm] Fix an "expected expression" error (PR #2434)

Ruoyu Zhong notifications at github.com
Thu Mar 16 16:35:06 UTC 2023


In C, a label should be followed by a statement, not a declaration. The `setmeta` label in `lib/fsm.c` violated this, and led to a build error with an error message like the one below:

```
  fsm.c:1019:6: error: expected expression
              int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
              ^
  fsm.c:1020:29: error: use of undeclared identifier 'mayopen'
              if (!rc && fd == -1 && mayopen) {
                                     ^
  2 errors generated.
```

This could be fixed by introducing an empty statement (a single colon). That is a statement.

This failure was seen while packaging RPM for [Homebrew](https://github.com/Homebrew/brew) in https://github.com/Homebrew/homebrew-core/pull/125606. It appeared on both x86_64 and arm64 platforms, running macOS 13 (Ventura). The compiler used was Apple Clang 14.0.0 build 1400.

You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/2434

-- Commit Summary --

  * Fix an "expected expression" error

-- File Changes --

    M lib/fsm.c (1)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/2434.patch
https://github.com/rpm-software-management/rpm/pull/2434.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2434
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2434 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20230316/ca857131/attachment.html>


More information about the Rpm-maint mailing list