Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building in ISO C23 #580

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Fix building in ISO C23 #580

merged 1 commit into from
Feb 10, 2025

Conversation

ppisar
Copy link
Contributor

@ppisar ppisar commented Feb 7, 2025

ISO C23 added bool type as a keyword. It is the standard GCC 15 uses by default and compilation of bindings/perl/solv_perl.c fails then:

bindings/perl/solv_perl.c:1641:13: error: ‘bool’ cannot be defined via ‘typedef’
 1641 | typedef int bool;
  |             ^~~~
/home/test/fedora/libsolv/libsolv-0.7.31-build/libsolv-0.7.31/redhat-linux-build/bindings/perl/solv_perl.c:1641:13: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
/home/test/fedora/libsolv/libsolv-0.7.31-build/libsolv-0.7.31/redhat-linux-build/bindings/perl/solv_perl.c:1641:1: warning: useless type name in empty declaration
 1641 | typedef int bool;
  | ^~~~~~~

The typedef comes from bindings/solv.i which attemps to supply it in case Swig undefines it.

This patch fixes it by not defining it in case ISO C23 or newer is in use. Keywords cannot be checked by a preprocessor, neither undefined (by Swig).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2340762

ISO C23 added bool type as a keyword. It is the standard GCC 15 uses by default and
compilation of bindings/perl/solv_perl.c fails then:

    bindings/perl/solv_perl.c:1641:13: error: ‘bool’ cannot be defined via ‘typedef’
     1641 | typedef int bool;
	  |             ^~~~
    /home/test/fedora/libsolv/libsolv-0.7.31-build/libsolv-0.7.31/redhat-linux-build/bindings/perl/solv_perl.c:1641:13: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
    /home/test/fedora/libsolv/libsolv-0.7.31-build/libsolv-0.7.31/redhat-linux-build/bindings/perl/solv_perl.c:1641:1: warning: useless type name in empty declaration
     1641 | typedef int bool;
	  | ^~~~~~~

The typedef comes from bindings/solv.i which attemps to supply it in case Swig
undefines it.

This patch fixes it by not defining it in case ISO C23 or newer is in
use. Keywords cannot be checked by a preprocessor, neither undefined
(by Swig).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2340762
@mlschroe mlschroe merged commit 2a8217d into openSUSE:master Feb 10, 2025
1 check passed
@mlschroe
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants