python: Changes required in order to build on newer gcc compiler 9.4 #1
Open
ani-sinha wants to merge 5 commits intobiosbits:bitsfrom
Open
python: Changes required in order to build on newer gcc compiler 9.4 #1ani-sinha wants to merge 5 commits intobiosbits:bitsfrom
ani-sinha wants to merge 5 commits intobiosbits:bitsfrom
Conversation
In many cases, the callback function pointers in PyMethodDef definitions are
cast to PyCFunction type where as their actual signature matches that of
PyCFunctionWithKeywords type. This issue exists throughout in python 2.7
codebase in general. On newer compilers, this produces a compile time failure
like the following:
build/grub/grub-core/contrib/python/bitsmodule.c:558:16: error: cast between incompatible function types from 'PyObject * (*)(PyObject *, PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *)'} [-Werror=cast-function-type]
558 | {"get_xy", (PyCFunction)bits_get_xy, METH_KEYWORDS, "get_xy(term) -> (cursor_x, cursor_y)"},
Pass -Wno-cast-function-type in compiler cflags in order to suppress this
failure.
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Fix indentation so as to improve readability. Signed-off-by: Ani Sinha <ani@anisinha.ca>
This change is cosmetic and only silences a gcc warning (-Wint-in-bool-context) Signed-off-by: Ani Sinha <ani@anisinha.ca>
All changes in this patch tries to address implicit fallthrough warnings on the newer gcc compiler. Signed-off-by: Ani Sinha <ani@anisinha.ca>
Bad confusing indentation was causing build failures under gcc 11. Fix them. Signed-off-by: Ani Sinha <ani@anisinha.ca>
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.
These are all the changes required to build python on the newer gcc 9.4 compiler