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

lib/misc.c: fix build against -std=c23 (void (*)()) changed the mea… #327

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Nov 17, 2024

…ning)

gcc-15 switched to -std=c23 by default:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result lsof fails the build as:

 misc.c:390:26: error: too many arguments to function 'r_fn'
   390 |                     rv = r_fn(r_arg, r.r_rbuf, r_rbln);
       |                          ^~~~

Before C23 int (*)() meant any function that returns int. In C23 if means only int (*)(void). But lsof alwaus uses int (*)(char *path, char *buf, int len) in that place. Switched to explicit function type instead.

…ning)

gcc-15 switched to -std=c23 by default:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result `lsof` fails the build as:

     misc.c:390:26: error: too many arguments to function 'r_fn'
       390 |                     rv = r_fn(r_arg, r.r_rbuf, r_rbln);
           |                          ^~~~

Before C23 `int (*)()` meant any function that returns `int`. In `C23`
if means only `int (*)(void)`. But `lsof` alwaus uses
`int (*)(char *path, char *buf, int len)` in that place. Switched to
explicit function type instead.
@jiegec jiegec merged commit b272609 into lsof-org:master Nov 18, 2024
14 of 15 checks passed
@trofi trofi deleted the gcc-15-c23 branch November 18, 2024 06:19
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