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 #309

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Fix building in ISO C23 #309

merged 1 commit into from
Feb 17, 2025

Conversation

ppisar
Copy link
Contributor

@ppisar ppisar commented Feb 11, 2025

Building with GCC 15, which defaults to ISO C23, failed like this:

In file included from lib/SDL_perl.xs:32:
lib/SDL_perl.c:654:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
  654 | XS_EXTERNAL(boot_SDL); /* prototype to pass -Wmissing-prototypes */
  |             ^~~~~~~~
/usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
  149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
  |                                  ^~~~
lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
  147 | void boot_SDL();
  |      ^~~~~~~~
lib/SDL_perl.c:655:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
  655 | XS_EXTERNAL(boot_SDL)
  |             ^~~~~~~~
/usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
  149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
  |                                  ^~~~
lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
  147 | void boot_SDL();
  |      ^~~~~~~~

The cause is a mismatch between how boot_SDL() was declared and used in src/SDL.xs and how Perl generates a boot function for XS packages. This patch fixes it by passing current Perl interpreter and, probably ignored, cv argument.

Resolves: #294
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2341036

Building with GCC 15, which defaults to ISO C23, failed like this:

    In file included from lib/SDL_perl.xs:32:
    lib/SDL_perl.c:654:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
      654 | XS_EXTERNAL(boot_SDL); /* prototype to pass -Wmissing-prototypes */
	  |             ^~~~~~~~
    /usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
      149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
	  |                                  ^~~~
    lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
      147 | void boot_SDL();
	  |      ^~~~~~~~
    lib/SDL_perl.c:655:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
      655 | XS_EXTERNAL(boot_SDL)
	  |             ^~~~~~~~
    /usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
      149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
	  |                                  ^~~~
    lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
      147 | void boot_SDL();
	  |      ^~~~~~~~

The cause is a mismatch between how boot_SDL() was declared and used
in src/SDL.xs and how Perl generates a boot function for XS packages.
This patch fixes it by passing current Perl interpreter and, probably
ignored, cv argument.

Resolves: PerlGameDev#294
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2341036
@dod38fr dod38fr merged commit b1eee65 into PerlGameDev:master Feb 17, 2025
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.

bad call to boot_SDL() breaks some platforms
2 participants