[libcxx-commits] [libcxx] 96918f2 - [libcxx] String format class marked as packed

Stefan Pintilie via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 08:07:24 PST 2022


Author: Stefan Pintilie
Date: 2022-02-25T10:07:19-06:00
New Revision: 96918f2af67f4edb6d6e987e03c0318ae04ba929

URL: https://github.com/llvm/llvm-project/commit/96918f2af67f4edb6d6e987e03c0318ae04ba929
DIFF: https://github.com/llvm/llvm-project/commit/96918f2af67f4edb6d6e987e03c0318ae04ba929.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/include/__format/parser_std_format_spec.h
    libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp
    libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp
    libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp
    libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index acedbdb91f212..aba04f84d64b8 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 f92a9facaa982..92c8986e760c2 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 @@ class _LIBCPP_TYPE_VIS _Flags {
 
   _Type __type{_Type::__default};
 };
+_LIBCPP_PACKED_BYTE_FOR_AIX_END
 
 namespace __detail {
 template <class _CharT>

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 772cffbc33d48..cc939b1fef0f0 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
 
 // <format>
 

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 e2306e1849ad9..e7b0caa6a6698 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
 
 // <format>
 

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 bb915e6019869..171d368921bc0 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
 
 // <format>
 

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 d8be9171040ab..bf44ee3e1b861 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
 
 // <format>
 


        


More information about the libcxx-commits mailing list