Fix preprocessor error on non-RHEL kernels >= 7.0 - #26
Open
sergiobaiao wants to merge 2 commits into
Open
Conversation
RHEL_RELEASE_VERSION() is a function-like macro only defined on RHEL
kernels. Using it in a compound #if expression alongside
`defined RHEL_RELEASE_CODE` fails on non-RHEL kernels because GCC
expands all macros before evaluating logical operators — there is no
true short-circuit at expansion time. The result is that the undefined
RHEL_RELEASE_VERSION expands to 0, and the trailing (9, x) argument
list produces: "missing binary operator before token '('".
Restructure both affected guards into nested #ifdef blocks so
RHEL_RELEASE_VERSION() is only reached by the preprocessor on kernels
where it is defined:
- gasket_interrupt.c: eventfd_signal() arity guard (>= 6.8.0 / RHEL 9.5)
- gasket_core.c: class_create() arity guard (>= 6.4.0 / RHEL 9.4)
Fixes build on Ubuntu/mainline kernel 7.0.0.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Confirmed working on Promox 9 with kernel 7.0.6-2-pve |
Author
|
please merge this, and also put the commands to build the packages back on the README: debuild -us -uc -tc -b (for debian/ubuntu at least) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building on non-RHEL kernels >= 7.0 (e.g. Ubuntu mainline) fails with:
RHEL_RELEASE_VERSIONis a function-like macro defined only on RHEL kernels. When used in a compound#ifexpression on non-RHEL kernels, GCC expands all macros before evaluating logical operators — there is no short-circuit at expansion time. The undefinedRHEL_RELEASE_VERSIONexpands to0, and the trailing(9, x)argument list then produces the "missing binary operator" syntax error, even thoughdefined RHEL_RELEASE_CODEis false.Fix
Restructure both affected guards into nested
#ifdefblocks soRHEL_RELEASE_VERSION()is only reached by the preprocessor on kernels where it is defined:gasket_interrupt.c:eventfd_signal()arity guard (>= 6.8.0/ RHEL 9.5 backport)gasket_core.c:class_create()arity guard (>= 6.4.0/ RHEL 9.4 backport)The logic is equivalent to the original intent — RHEL backport paths are preserved — but the preprocessor no longer encounters
RHEL_RELEASE_VERSION()on kernels where it is undefined.Test
Verified build and
dpkg -iinstall on Ubuntu kernel7.0.0-15-generic. Bothgasket.koandapex.kocompile, sign, and install via DKMS successfully.🤖 Generated with Claude Code