Skip to content

fix building issue when using gcc15 with "-flto -Werror=lto-type-mismatc" #13736

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

clan
Copy link

@clan clan commented Jun 29, 2025

otherwise build is failed with:

error: static declaration of ‘rb_io_closed_p’ follows non-static declaration

@nobu
Copy link
Member

nobu commented Jun 30, 2025

Please send the patches for io-console and strscan to each upstreams.

@nobu
Copy link
Member

nobu commented Jun 30, 2025

And a typo in the last commit log, socketc should be socket, I guess.

@clan
Copy link
Author

clan commented Jun 30, 2025

Please send the patches for io-console and strscan to each upstreams.

ah, i think this is the reason why these two functions (maybe more) are implemented again?

@nobu
Copy link
Member

nobu commented Jun 30, 2025

I don't think this fix is the best.
Probably it can be fixed by passing the header name to have_func calls, such ash have_func("rb_io_path", "ruby/io.h").

@nobu
Copy link
Member

nobu commented Jun 30, 2025

Anyway, this may need backports to stable branches.
Could you file an issue at the BTS?

otherwise, when compiling using gcc 15 with "-flto
-Werror=lto-type-mismatch", ext/io/console/extconf.h will have:

> #define HAVE_RB_IO_PATH 1
> #define HAVE_RB_IO_DESCRIPTOR 1
> #define HAVE_RB_IO_GET_WRITE_IO 1
> #define HAVE_RB_IO_CLOSED_P 1
> #define HAVE_RB_IO_OPEN_DESCRIPTOR 1

the build is failed with:

> console.c:1417:1: error: static declaration of ‘rb_io_closed_p’ follows non-static declaration
>  1417 | rb_io_closed_p(VALUE io)
>       | ^~~~~~~~~~~~~~
> ../../.././include/ruby/io.h:385:7: note: previous declaration of ‘rb_io_closed_p’ with type ‘VALUE(VALUE)’ {aka ‘long unsigned int(long unsigned int)’}
>   385 | VALUE rb_io_closed_p(VALUE io);
>       |       ^~~~~~~~~~~~~~

Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
@clan
Copy link
Author

clan commented Jul 1, 2025

Anyway, this may need backports to stable branches. Could you file an issue at the BTS?

ok, problem on ext/strscan had been fixed in commit 4585ccd, backport is needed.

will file an issue when free.

otherwise, gcc 15 will complain:

> init.c:573:19: error: too many arguments to function ‘Rconnect’; expected 0, have 3
>   573 |     return (VALUE)Rconnect(arg->fd, arg->sockaddr, arg->len);
>       |                   ^~~~~~~~ ~~~~~~~
> In file included from init.c:11:
> rubysocket.h:294:5: note: declared here
>   294 | int Rconnect();
>       |     ^~~~~~~~

> sockssocket.c:33:9: error: too many arguments to function ‘SOCKSinit’; expected 0, have 1
>    33 |         SOCKSinit("ruby");
>       |         ^~~~~~~~~ ~~~~~~
> In file included from sockssocket.c:11:
> rubysocket.h:293:6: note: declared here
>   293 | void SOCKSinit();
>       |      ^~~~~~~~~

Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
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