Skip to content

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

Closed

Description

@shailshouryya

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

Activity

  1. added a commit that references this issue on Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions