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

gcc: fix some compiler errors from the new GCC #1658

Merged
merged 4 commits into from
Jun 1, 2024

Conversation

panjf2000
Copy link
Contributor

@panjf2000 panjf2000 commented May 18, 2024

New compiler errors to be fixed: [-Wincompatible-pointer-types], [-Wint-conversion], and [-Wcast-function-type]


The CI failure for -Wincompatible-pointer-types may have something to do with this GCC patch. See also this llvm/llvm-project#74605.

Thus, I think we should explicitly cast the int pointer to the expected type to avoid these compiler errors.

@azat

@panjf2000 panjf2000 changed the title gcc: fix the -Wincompatible-pointer-types errors gcc: fix the -Wincompatible-pointer-types compiler errors May 18, 2024
@panjf2000 panjf2000 changed the title gcc: fix the -Wincompatible-pointer-types compiler errors gcc: fix the compiler errors of -Wincompatible-pointer-types May 18, 2024
evutil.c Show resolved Hide resolved
@panjf2000
Copy link
Contributor Author

I think we may want to cancel those outdated CI jobs for this PR manually to make room for the latest one. @azat

@panjf2000 panjf2000 requested a review from azat May 19, 2024 08:10
@panjf2000
Copy link
Contributor Author

New failure arose, caused by Bug 106416 - -Wint-conversion should be an error, not a pedwarn

@panjf2000 panjf2000 changed the title gcc: fix the compiler errors of -Wincompatible-pointer-types gcc: fix the compiler errors of -Wincompatible-pointer-types and -Wint-conversion May 20, 2024
@panjf2000 panjf2000 force-pushed the win-keepalive branch 2 times, most recently from 0b674f0 to 79d764e Compare May 20, 2024 03:29
@azat
Copy link
Member

azat commented May 20, 2024

Still something wrong

@panjf2000
Copy link
Contributor Author

Still something wrong

Yes, with -Wincompatible-pointer-types and -Wint-conversion being turned into error level on MinGW somehow, lots of code in libevent can't pass the GCC examination. Every time I fixed some code, new errors surfaced.

@azat
Copy link
Member

azat commented May 20, 2024

It should be pretty easy to fix, there is another option - turn off those warning for mingw build, but I don't like this idea

@panjf2000 panjf2000 changed the title gcc: fix the compiler errors of -Wincompatible-pointer-types and -Wint-conversion gcc: fix some compiler errors from the new GCC May 21, 2024
@panjf2000
Copy link
Contributor Author

Finally, all new compiler errors are fixed! https://github.com/libevent/libevent/actions/runs/9168188585/job/25206570042?pr=1658

I think we're good to go.

@panjf2000
Copy link
Contributor Author

Ping @azat

test/regress_main.c Outdated Show resolved Hide resolved
---------

Signed-off-by: Andy Pan <i@andypan.me>
---------

Signed-off-by: Andy Pan <i@andypan.me>
---------

Signed-off-by: Andy Pan <i@andypan.me>
---------

Signed-off-by: Andy Pan <i@andypan.me>
@azat
Copy link
Member

azat commented Jun 1, 2024

Thank you! Now LGTM (will merge once mingw build will pass)

@azat azat merged commit 13678f3 into libevent:master Jun 1, 2024
60 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants