Skip to content

Commit 733d38c

Browse files
committed
Add missing <stddef.h> to included files in Modules/zlibmodule.c
Recent CI builds are failing because the `offsetof` function in `Modules/zlibmodule.c` cannot be called. For example, see https://buildbot.python.org/all/#/builders/15/builds/5217/steps/4/logs/stdio from commit fabcbe9. Here is a relevant snippet from the stdio logs for step 4 compile: ``` ../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) ^~~~~~~~~~ ```
1 parent 33838fe commit 733d38c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Modules/zlibmodule.c

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "zlib.h"
99
#include "stdbool.h"
10+
#include <stddef.h> // offsetof()
1011

1112
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM < 0x1221
1213
#error "At least zlib version 1.2.2.1 is required"

0 commit comments

Comments
 (0)