[openssl-dev] [openssl.org #3684] Missing <stddef.h> for source files using offsetof
noloader@gmail.com via RT
rt at openssl.org
Mon Feb 2 06:49:14 UTC 2015
It appears a couple of source files are using the offsetof macro
defined in <staddef.h>. However, those files are *not* including
<stddef.h>, which is causing intermittent compile problems. For
example, http://stackoverflow.com/q/28246642/608639.
Please add "#include <stddef.h> to the following files:
crypto/asn1/asn1t.h
crypto/rand/rand_egd.c
**********
In addition, rand_egd.c should probably have its own definition of
offsetof removed since its not quite right (its not using GCC
__builtin_offsetof for GCC 3.5 and above).
If the project wants to include a definition (which appears to be
unneeded), then may be something like the following should be used:
#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3)
# ifndef __offsetof
# define __offsetof(type, field) __builtin_offsetof(type, field)
# endif
# define offsetof(type, field) __builtin_offsetof(type, field)
#else /* ! (gcc >= 3.5) */
# ifndef __offsetof
# define __offsetof(type, field) ((size_t)(&((type *)0)->field))
# endif
# define offsetof(type, field) ((size_t)(&((type *)0)->field))
#endif
More information about the openssl-dev
mailing list