From e27855032a6c9cb2339f7847658d9837861cd487 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 21 Dec 2023 21:28:36 +0000 Subject: [PATCH] Auto-generate files after cl/592935088 --- php/ext/google/protobuf/php-upb.c | 11 ++++++++++- php/ext/google/protobuf/php-upb.h | 8 ++++++++ ruby/ext/google/protobuf_c/ruby-upb.c | 11 ++++++++++- ruby/ext/google/protobuf_c/ruby-upb.h | 8 ++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 6c8d4fc26506..7ab0b5248e83 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -95,6 +95,13 @@ Error, UINTPTR_MAX is undefined #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) #endif +#ifdef _MSC_VER +// Some versions of our Windows compiler don't support the C11 syntax. +#define UPB_ALIGN_AS(x) __declspec(align(x)) +#else +#define UPB_ALIGN_AS(x) _Alignas(x) +#endif + // Hints to the compiler about likely/unlikely branches. #if defined (__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) @@ -10983,7 +10990,8 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, * initialized to zeroes. * * We have to allocate an extra pointer for upb's internal metadata. */ -static const char opt_default_buf[_UPB_MAXOPT_SIZE + sizeof(void*)] = {0}; +static UPB_ALIGN_AS(8) const + char opt_default_buf[_UPB_MAXOPT_SIZE + sizeof(void*)] = {0}; const char* kUpbDefOptDefault = &opt_default_buf[sizeof(void*)]; const char* _upb_DefBuilder_FullToShort(const char* fullname) { @@ -15794,6 +15802,7 @@ const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC #undef UPB_ALIGN_OF +#undef UPB_ALIGN_AS #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index d31ab2d53059..87af0ee6e5ae 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -94,6 +94,13 @@ Error, UINTPTR_MAX is undefined #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) #endif +#ifdef _MSC_VER +// Some versions of our Windows compiler don't support the C11 syntax. +#define UPB_ALIGN_AS(x) __declspec(align(x)) +#else +#define UPB_ALIGN_AS(x) _Alignas(x) +#endif + // Hints to the compiler about likely/unlikely branches. #if defined (__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) @@ -13968,6 +13975,7 @@ UPB_INLINE const char* upb_WireReader_SkipValue( #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC #undef UPB_ALIGN_OF +#undef UPB_ALIGN_AS #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index efd6dd089ec2..bcfca4d07e32 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -95,6 +95,13 @@ Error, UINTPTR_MAX is undefined #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) #endif +#ifdef _MSC_VER +// Some versions of our Windows compiler don't support the C11 syntax. +#define UPB_ALIGN_AS(x) __declspec(align(x)) +#else +#define UPB_ALIGN_AS(x) _Alignas(x) +#endif + // Hints to the compiler about likely/unlikely branches. #if defined (__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) @@ -10499,7 +10506,8 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, * initialized to zeroes. * * We have to allocate an extra pointer for upb's internal metadata. */ -static const char opt_default_buf[_UPB_MAXOPT_SIZE + sizeof(void*)] = {0}; +static UPB_ALIGN_AS(8) const + char opt_default_buf[_UPB_MAXOPT_SIZE + sizeof(void*)] = {0}; const char* kUpbDefOptDefault = &opt_default_buf[sizeof(void*)]; const char* _upb_DefBuilder_FullToShort(const char* fullname) { @@ -15310,6 +15318,7 @@ const char* _upb_WireReader_SkipGroup(const char* ptr, uint32_t tag, #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC #undef UPB_ALIGN_OF +#undef UPB_ALIGN_AS #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 3e2d23cc185a..005e2349c286 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -96,6 +96,13 @@ Error, UINTPTR_MAX is undefined #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) #endif +#ifdef _MSC_VER +// Some versions of our Windows compiler don't support the C11 syntax. +#define UPB_ALIGN_AS(x) __declspec(align(x)) +#else +#define UPB_ALIGN_AS(x) _Alignas(x) +#endif + // Hints to the compiler about likely/unlikely branches. #if defined (__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) @@ -13787,6 +13794,7 @@ UPB_INLINE const char* upb_WireReader_SkipValue( #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC #undef UPB_ALIGN_OF +#undef UPB_ALIGN_AS #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY