[libcxx-commits] [PATCH] D121009: [libc++] Simplify how __format_spec::_Flags is packed on AIX
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 4 09:35:43 PST 2022
ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
I don't think we really need to introduce a mechanism involving pragma
push/pop for just that tiny workaround. I'd rather keep the workaround
localized than pretend it's a general thing and complicate our __config
for something that we'll only ever use in one place.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121009
Files:
libcxx/include/__config
libcxx/include/__format/parser_std_format_spec.h
Index: libcxx/include/__format/parser_std_format_spec.h
===================================================================
--- libcxx/include/__format/parser_std_format_spec.h
+++ libcxx/include/__format/parser_std_format_spec.h
@@ -42,6 +42,12 @@
namespace __format_spec {
+#if defined(_AIX)
+# define _LIBCPP_PACK_FLAGS_ON_AIX __attribute__((__packed__))
+#else
+# define _LIBCPP_PACK_FLAGS_ON_AIX
+#endif
+
/**
* Contains the flags for the std-format-spec.
*
@@ -52,8 +58,7 @@
* * 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 {
+class _LIBCPP_TYPE_VIS _LIBCPP_PACK_FLAGS_ON_AIX _Flags {
public:
enum class _LIBCPP_ENUM_VIS _Alignment : uint8_t {
/**
@@ -110,7 +115,6 @@
_Type __type{_Type::__default};
};
-_LIBCPP_PACKED_BYTE_FOR_AIX_END
namespace __detail {
template <class _CharT>
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1436,14 +1436,6 @@
# 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121009.413044.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220304/2fce7987/attachment.bin>
More information about the libcxx-commits
mailing list