From 96918f2af67f4edb6d6e987e03c0318ae04ba929 Mon Sep 17 00:00:00 2001 From: Stefan Pintilie Date: Fri, 25 Feb 2022 09:26:25 -0600 Subject: [PATCH] [libcxx] String format class marked as packed This patch marks the class _Flags as packed because the design assumes that it is packed and a number of tests also assume that it is packed. However on AIX the class is not packed unless it is marked as such. Reviewed By: hubert.reinterpretcast, #libc, Mordante, ldionne, Quuxplusone Differential Revision: https://reviews.llvm.org/D119567 --- libcxx/include/__config | 8 ++++++++ libcxx/include/__format/parser_std_format_spec.h | 2 ++ .../format.string/format.string.std/std_format_spec_bool.pass.cpp | 1 - .../format.string/format.string.std/std_format_spec_char.pass.cpp | 1 - .../format.string.std/std_format_spec_integer.pass.cpp | 1 - .../format.string.std/std_format_spec_string.pass.cpp | 1 - 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libcxx/include/__config b/libcxx/include/__config index acedbdb..aba04f8 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1440,6 +1440,14 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) #endif +#if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC) +#define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)") +#define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)") +#else +#define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */ +#define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */ +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h index f92a9fa..92c8986 100644 --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -52,6 +52,7 @@ namespace __format_spec { * * The format-type filtering needs to be done post parsing in the parser * derived from @ref __parser_std. */ +_LIBCPP_PACKED_BYTE_FOR_AIX class _LIBCPP_TYPE_VIS _Flags { public: enum class _LIBCPP_ENUM_VIS _Alignment : uint8_t { @@ -109,6 +110,7 @@ public: _Type __type{_Type::__default}; }; +_LIBCPP_PACKED_BYTE_FOR_AIX_END namespace __detail { template diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp index 772cffb..cc939b1 100644 --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp @@ -8,7 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: libcpp-no-concepts // UNSUPPORTED: libcpp-has-no-incomplete-format -// XFAIL: LIBCXX-AIX-FIXME // diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp index e2306e1..e7b0caa 100644 --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp @@ -8,7 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: libcpp-no-concepts // UNSUPPORTED: libcpp-has-no-incomplete-format -// XFAIL: LIBCXX-AIX-FIXME // diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp index bb915e6..171d368 100644 --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp @@ -8,7 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: libcpp-no-concepts // UNSUPPORTED: libcpp-has-no-incomplete-format -// XFAIL: LIBCXX-AIX-FIXME // diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp index d8be917..bf44ee3 100644 --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp @@ -8,7 +8,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: libcpp-no-concepts // UNSUPPORTED: libcpp-has-no-incomplete-format -// XFAIL: LIBCXX-AIX-FIXME // -- 2.7.4