[build] Fix build failures with older versions of gcc

Some versions of gcc (observed with gcc 4.8.5 in CentOS 7) will report
spurious build_assert() failures for some assertions about structure
layouts.  There is no clear pattern as to what causes these spurious
failures, and the build assertion does succeed in that no unresolvable
symbol reference is generated in the compiled code.

Adjust the assertions to work around these apparent compiler issues.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-02-10 14:41:29 +00:00
parent 0f5abd8b11
commit 94b39fbe92
2 changed files with 10 additions and 7 deletions

View File

@@ -89,7 +89,8 @@ static int _gcm_name ## _setkey ( void *ctx, const void *key, \
size_t keylen ) { \
struct _gcm_name ## _context *context = ctx; \
build_assert ( _blocksize == sizeof ( context->gcm.key ) ); \
build_assert ( ( ( void * ) &context->gcm ) == ctx ); \
build_assert ( ( ( void * ) &context->gcm ) == \
( ( void * ) context ) ); \
build_assert ( ( ( void * ) &context->raw ) == \
( ( void * ) context->gcm.raw_ctx ) ); \
return gcm_setkey ( &context->gcm, key, keylen, &_raw_cipher ); \