Skip to content

Add <stddef.h> to Modules/zlibmodule.c to fix failing builds #107279

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

Closed
shailshouryya opened this issue Jul 26, 2023 · 0 comments
Closed

Add <stddef.h> to Modules/zlibmodule.c to fix failing builds #107279

shailshouryya opened this issue Jul 26, 2023 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@shailshouryya
Copy link
Contributor

shailshouryya commented Jul 26, 2023

Bug report

Commits fabcbe9, 6a43cce, and 2b1a81e (and likely other commits) are failing during the build step with the following error:

../Modules/zlibmodule.c:1802:21: error: implicit declaration of function ‘offsetof’ [-Werror=implicit-function-declaration]
 #define COMP_OFF(x) offsetof(compobject, x)
                     ^~~~~~~~
../Modules/zlibmodule.c:1804:39: note: in expansion of macro ‘COMP_OFF’
     {"unused_data",     _Py_T_OBJECT, COMP_OFF(unused_data), Py_READONLY},
                                       ^~~~~~~~
../Modules/zlibmodule.c:1802:21: note: ‘offsetof’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
../Modules/zlibmodule.c:1776:1:
+#include <stddef.h>
 
../Modules/zlibmodule.c:1802:21:
 #define COMP_OFF(x) offsetof(compobject, x)
                     ^~~~~~~~
../Modules/zlibmodule.c:1804:39: note: in expansion of macro ‘COMP_OFF’
     {"unused_data",     _Py_T_OBJECT, COMP_OFF(unused_data), Py_READONLY},
                                       ^~~~~~~~
../Modules/zlibmodule.c:1802:30: error: expected expression before ‘compobject’
 #define COMP_OFF(x) offsetof(compobject, x)
                              ^~~~~~~~~~
../Modules/zlibmodule.c:1804:39: note: in expansion of macro ‘COMP_OFF’
     {"unused_data",     _Py_T_OBJECT, COMP_OFF(unused_data), Py_READONLY},
                                       ^~~~~~~~
../Modules/zlibmodule.c:1802:30: error: expected expression before ‘compobject’
 #define COMP_OFF(x) offsetof(compobject, x)
                              ^~~~~~~~~~
../Modules/zlibmodule.c:1805:39: note: in expansion of macro ‘COMP_OFF’
     {"unconsumed_tail", _Py_T_OBJECT, COMP_OFF(unconsumed_tail), Py_READONLY},
                                       ^~~~~~~~
../Modules/zlibmodule.c:1802:30: error: expected expression before ‘compobject’
 #define COMP_OFF(x) offsetof(compobject, x)
                              ^~~~~~~~~~
../Modules/zlibmodule.c:1806:38: note: in expansion of macro ‘COMP_OFF’
     {"eof",             Py_T_BOOL,   COMP_OFF(eof), Py_READONLY},
                                      ^~~~~~~~
../Modules/zlibmodule.c:1820:33: error: expected expression before ‘ZlibDecompressor’
     {"eof", Py_T_BOOL, offsetof(ZlibDecompressor, eof),
                                 ^~~~~~~~~~~~~~~~
../Modules/zlibmodule.c:1820:24: error: initializer element is not constant
     {"eof", Py_T_BOOL, offsetof(ZlibDecompressor, eof),
                        ^~~~~~~~
../Modules/zlibmodule.c:1820:24: note: (near initialization for ‘ZlibDecompressor_members[0].offset’)
../Modules/zlibmodule.c:1822:46: error: expected expression before ‘ZlibDecompressor’
     {"unused_data", Py_T_OBJECT_EX, offsetof(ZlibDecompressor, unused_data),
                                              ^~~~~~~~~~~~~~~~
../Modules/zlibmodule.c:1822:37: error: initializer element is not constant
     {"unused_data", Py_T_OBJECT_EX, offsetof(ZlibDecompressor, unused_data),
                                     ^~~~~~~~
../Modules/zlibmodule.c:1822:37: note: (near initialization for ‘ZlibDecompressor_members[1].offset’)
../Modules/zlibmodule.c:1824:41: error: expected expression before ‘ZlibDecompressor’
     {"needs_input", Py_T_BOOL, offsetof(ZlibDecompressor, needs_input), Py_READONLY,
                                         ^~~~~~~~~~~~~~~~
../Modules/zlibmodule.c:1824:32: error: initializer element is not constant
     {"needs_input", Py_T_BOOL, offsetof(ZlibDecompressor, needs_input), Py_READONLY,
                                ^~~~~~~~
../Modules/zlibmodule.c:1824:32: note: (near initialization for ‘ZlibDecompressor_members[2].offset’)
cc1: some warnings being treated as errors
make: *** [Makefile:2998: Modules/zlibmodule.o] Error 1

Your environment

This is occurring in the python/cpython CICD pipeline. Clicking on the ❌ icon in the commits linked to above and checking the logs for the failing builds shows the error. Examples:

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants