Skip to content

Commit

Permalink
Update fixtures to fix the compiler tests on macos
Browse files Browse the repository at this point in the history
Summary: Reorder the struct fields so that `cpp.MinimizePadding` doesn't end up with a different layout due to `alignof(std::max_align_t)` varying across different platforms, such as mac-arm64 and linux-amd64.

Reviewed By: praihan

Differential Revision: D68926839

fbshipit-source-id: 5aa23d2da81597d53b6ecd9887fd5aa7bc6b5607
  • Loading branch information
yoney authored and facebook-github-bot committed Jan 31, 2025
1 parent 82849ab commit 5a84514
Show file tree
Hide file tree
Showing 30 changed files with 347 additions and 347 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace apache::thrift::fixtures::types {
namespace module_constants {


::std::string_view _fbthrift_schema_cbf7f73e50f28c81() {
::std::string_view _fbthrift_schema_4543be4a92b4107e() {
return "";
}
::folly::Range<const ::std::string_view*> _fbthrift_schema_cbf7f73e50f28c81_includes() {
::folly::Range<const ::std::string_view*> _fbthrift_schema_4543be4a92b4107e_includes() {
return {};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace apache::thrift::fixtures::types {
/** Glean {"file": "thrift/compiler/test/fixtures/types/src/module.thrift"} */
namespace module_constants {

FOLLY_EXPORT ::std::string_view _fbthrift_schema_cbf7f73e50f28c81();
FOLLY_EXPORT ::folly::Range<const ::std::string_view*> _fbthrift_schema_cbf7f73e50f28c81_includes();
FOLLY_EXPORT ::std::string_view _fbthrift_schema_4543be4a92b4107e();
FOLLY_EXPORT ::folly::Range<const ::std::string_view*> _fbthrift_schema_4543be4a92b4107e_includes();

} // namespace module_constants
} // namespace apache::thrift::fixtures::types
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ THRIFT_DATA_MEMBER const std::array<int, 5> TStructDataStorage<::apache::thrift:
THRIFT_DATA_MEMBER const std::string_view TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::name = "MinPaddingWithCustomType";
THRIFT_DATA_MEMBER const std::array<std::string_view, 5> TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_names = { {
"small"sv,
"big"sv,
"medium"sv,
"biggish"sv,
"medium"sv,
"big"sv,
"tiny"sv,
}};
THRIFT_DATA_MEMBER const std::array<int16_t, 5> TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_ids = { {
Expand All @@ -312,16 +312,16 @@ THRIFT_DATA_MEMBER const std::array<int16_t, 5> TStructDataStorage<::apache::thr
}};
THRIFT_DATA_MEMBER const std::array<protocol::TType, 5> TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_types = { {
TType::T_BYTE,
TType::T_I64,
TType::T_I16,
TType::T_I32,
TType::T_I16,
TType::T_I64,
TType::T_BYTE,
}};
THRIFT_DATA_MEMBER const std::array<std::string_view, 5> TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::storage_names = { {
"__fbthrift_field_small"sv,
"__fbthrift_field_big"sv,
"__fbthrift_field_medium"sv,
"__fbthrift_field_biggish"sv,
"__fbthrift_field_medium"sv,
"__fbthrift_field_big"sv,
"__fbthrift_field_tiny"sv,
}};
THRIFT_DATA_MEMBER const std::array<int, 5> TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::isset_indexes = { {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,9 @@ class MinPaddingWithCustomType_struct_traits {
class __fbthrift_members {
public:
using small = __fbthrift_refl_impl::reflected_no_annotations;
using big = __fbthrift_refl_impl::reflected_no_annotations;
using medium = __fbthrift_refl_impl::reflected_no_annotations;
using biggish = __fbthrift_refl_impl::reflected_no_annotations;
using medium = __fbthrift_refl_impl::reflected_no_annotations;
using big = __fbthrift_refl_impl::reflected_no_annotations;
using tiny = __fbthrift_refl_impl::reflected_no_annotations;
};

Expand All @@ -752,17 +752,17 @@ class MinPaddingWithCustomType_struct_traits {
using type_class = ::apache::thrift::type_class::integral;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::small>;
};
struct __fbthrift_member_big {
struct __fbthrift_member_biggish {
using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType;
using name = __fbthrift_strings_module::__fbthrift_hash_2a21fe6d592a19b7de898b50eb53c429608de1a66f3e9f62da19714a770553d1;
using type = ::std::int64_t;
using tag = ::apache::thrift::ident::big;
using name = __fbthrift_strings_module::__fbthrift_hash_7af8f5c4c7c52a8a8bd7151e1a20e8003de8a0f5b4c08676355b69772b2ae1d7;
using type = ::std::int32_t;
using tag = ::apache::thrift::ident::biggish;
static constexpr ::apache::thrift::field_id_t id = 2;
static constexpr auto optional = ::apache::thrift::optionality::terse;
using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::big>;
using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::big>;
using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::biggish>;
using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::biggish>;
using type_class = ::apache::thrift::type_class::integral;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::big>;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::biggish>;
};
struct __fbthrift_member_medium {
using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType;
Expand All @@ -776,17 +776,17 @@ class MinPaddingWithCustomType_struct_traits {
using type_class = ::apache::thrift::type_class::integral;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::medium>;
};
struct __fbthrift_member_biggish {
struct __fbthrift_member_big {
using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType;
using name = __fbthrift_strings_module::__fbthrift_hash_7af8f5c4c7c52a8a8bd7151e1a20e8003de8a0f5b4c08676355b69772b2ae1d7;
using type = ::std::int32_t;
using tag = ::apache::thrift::ident::biggish;
using name = __fbthrift_strings_module::__fbthrift_hash_2a21fe6d592a19b7de898b50eb53c429608de1a66f3e9f62da19714a770553d1;
using type = ::std::int64_t;
using tag = ::apache::thrift::ident::big;
static constexpr ::apache::thrift::field_id_t id = 4;
static constexpr auto optional = ::apache::thrift::optionality::terse;
using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::biggish>;
using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::biggish>;
using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::big>;
using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::big>;
using type_class = ::apache::thrift::type_class::integral;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::biggish>;
using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::big>;
};
struct __fbthrift_member_tiny {
using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType;
Expand All @@ -803,9 +803,9 @@ class MinPaddingWithCustomType_struct_traits {

struct __fbthrift_member {
using small = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_small>;
using big = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_big>;
using medium = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_medium>;
using biggish = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_biggish>;
using medium = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_medium>;
using big = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_big>;
using tiny = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_tiny>;
};
public:
Expand All @@ -814,9 +814,9 @@ class MinPaddingWithCustomType_struct_traits {
using member = __fbthrift_member;
using members = ::fatal::list<
member::small,
member::big,
member::medium,
member::biggish,
member::medium,
member::big,
member::tiny
>;
using members_annotations = __fbthrift_annotations::members;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ struct ForEachField<::apache::thrift::fixtures::types::MinPaddingWithCustomType>
template <typename F, typename... T>
void operator()([[maybe_unused]] F&& f, [[maybe_unused]] T&&... t) const {
f(0, static_cast<T&&>(t).small_ref()...);
f(1, static_cast<T&&>(t).big_ref()...);
f(1, static_cast<T&&>(t).biggish_ref()...);
f(2, static_cast<T&&>(t).medium_ref()...);
f(3, static_cast<T&&>(t).biggish_ref()...);
f(3, static_cast<T&&>(t).big_ref()...);
f(4, static_cast<T&&>(t).tiny_ref()...);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ StructMetadata<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::gen
module_MinPaddingWithCustomType.is_union() = false;
static const auto* const
module_MinPaddingWithCustomType_fields = new std::array<EncodedThriftField, 5>{ {
{ 1, "small", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector<ThriftConstStruct>{ }}, { 2, "big", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector<ThriftConstStruct>{ }}, { 3, "medium", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I16_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("cpp.Adapter", { {"name", cvString("::my::Adapter") } }).cv_struct_ref(), }}, { 4, "biggish", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 5, "tiny", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector<ThriftConstStruct>{ }}, }};
{ 1, "small", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector<ThriftConstStruct>{ }}, { 2, "biggish", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }}, { 3, "medium", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I16_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("cpp.Adapter", { {"name", cvString("::my::Adapter") } }).cv_struct_ref(), }}, { 4, "big", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector<ThriftConstStruct>{ }}, { 5, "tiny", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector<ThriftConstStruct>{ }}, }};
for (const auto& f : *module_MinPaddingWithCustomType_fields) {
::apache::thrift::metadata::ThriftField field;
field.id() = f.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ MinPaddingWithCustomType& MinPaddingWithCustomType::operator=([[maybe_unused]] M
}


MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int64_t big__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int32_t biggish__arg, ::std::int8_t tiny__arg) :
MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int32_t biggish__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int64_t big__arg, ::std::int8_t tiny__arg) :
__fbthrift_field_medium(std::move(medium__arg)),
__fbthrift_field_big(std::move(big__arg)),
__fbthrift_field_biggish(std::move(biggish__arg)),
Expand All @@ -1453,25 +1453,25 @@ MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstr
void MinPaddingWithCustomType::__fbthrift_clear() {
// clear all fields
this->__fbthrift_field_small = ::std::int8_t();
this->__fbthrift_field_big = ::std::int64_t();
::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this);
this->__fbthrift_field_biggish = ::std::int32_t();
::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this);
this->__fbthrift_field_big = ::std::int64_t();
this->__fbthrift_field_tiny = ::std::int8_t();
}

void MinPaddingWithCustomType::__fbthrift_clear_terse_fields() {
this->__fbthrift_field_small = ::std::int8_t();
this->__fbthrift_field_big = ::std::int64_t();
::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this);
this->__fbthrift_field_biggish = ::std::int32_t();
::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this);
this->__fbthrift_field_big = ::std::int64_t();
this->__fbthrift_field_tiny = ::std::int8_t();
}

bool MinPaddingWithCustomType::__fbthrift_is_empty() const {
return ::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_small) &&
::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big) &&
::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag<MinPaddingWithCustomType, ::apache::thrift::field_id<3>>>(this->__fbthrift_field_medium) &&
::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish) &&
::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag<MinPaddingWithCustomType, ::apache::thrift::field_id<3>>>(this->__fbthrift_field_medium) &&
::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big) &&
::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_tiny);
}

Expand Down
Loading

0 comments on commit 5a84514

Please sign in to comment.