Skip to content

Build fails with GCC 16 default C23 (gnu23) due to old-style function declarations #549

Description

@ahhyoushh

Environment

  • Commit: 064b5144f868c9359082cdeb39ac23a76a68728b
  • OS: Fedora 44
  • Compiler: GCC 16.1.1
  • Architecture: x86_64

Description

A clean checkout fails to build with the default GCC 16 configuration on Fedora 44.

The build reports many errors of the form:

error: too many arguments to function 'HashKill'; expected 0, have 1
../utils/hash.h:107: note: declared here
extern void HashKill();

along with many similar errors such as:

error: number of arguments doesn't match prototype
error: conflicting types for ...
error: too many arguments to function ...

These occur across multiple modules (database, graphics, extract, commands, netmenu, etc.).

Steps to reproduce

git clone https://github.com/RTimothyEdwards/magic.git
cd magic

./configure
make -j$(nproc)

Result is the build fails with prototype mismatch errors.

Workaround

A simple workaround is

CFLAGS="-std=gnu17" ./configure
make -j$(nproc)

and it builds successfully.

From what I can tell, this appears to be related to GCC 15+ defaulting to gnu23, where empty parameter-list declarations (for example extern void Foo();) are interpreted differently than under previous defaults, exposing legacy K&R-style declarations throughout the codebase.

Question

Would you prefer a contribution that:

  1. Adds a temporary build-system workaround (for example using -std=gnu17 where appropriate), or
  2. Modernizes the old-style declarations/prototypes so the project builds cleanly under newer GCC defaults?

I'd be happy to work on this issue whichever direction you prefer. Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions