cybernoid / archivemount

A fuse filesystem for mounting archives in formats supported by libarchive.
Other
184 stars 19 forks source link

fix compile error with gcc-9.2.1 #12

Closed nixpanic closed 4 years ago

nixpanic commented 4 years ago

Fedora Rawhide (upcoming Fedora 33) has gcc-9.2.1 which causes compiling archivemount to fail with the following error:

archivemount.c: In function ‘getLine’:
archivemount.c:2817:4: error: case label does not reduce to an integer constant
 2817 |    case delim: (*lineptr)[count++] = c;    /* fall through */
      |    ^~~~

The 'delim' integer constant for the switch statement should be a compile time constant, so either hard-coded or #define'd.

bziemons commented 4 years ago

Just curious: Have you tried constexpr instead of const ?

nixpanic commented 4 years ago

On Mon, Apr 20, 2020 at 02:05:32AM -0700, Benedikt Ziemons wrote:

Just curious: Have you tried constexpr instead of const ?

No, and I have never seen constexpr before. Searching for that suggests it is a C++ feature, so it would not be useable for C programs.

cybernoid commented 4 years ago

I used constexpr a lot in C++ in recent years because in contrast to define it is subject to type checking, but I'm also not aware that this is a feature available in C. Modern C++ is a much more potent and (when used correctly) arguably even less error prone language than plane old C, but I have no plans to reimplement archivemount since I never really used it myself and therefore it is in maintenance mode for years, living from contributions only.


Von: Niels de Vos notifications@github.com Gesendet: Montag, 20. April 2020 11:52 An: cybernoid/archivemount Cc: Subscribed Betreff: Re: [cybernoid/archivemount] fix compile error with gcc-9.2.1 (#12)

On Mon, Apr 20, 2020 at 02:05:32AM -0700, Benedikt Ziemons wrote:

Just curious: Have you tried constexpr instead of const ?

No, and I have never seen constexpr before. Searching for that suggests it is a C++ feature, so it would not be useable for C programs.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bziemons commented 4 years ago

Pardon me, you are absolutely right. For some reason I was assuming this was a C++ project when I wrote that, ignoring all the signs of it being a C project :)