[PATCH] D119567: [libcxx] String format class marked as packed

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 18 15:15:01 PST 2022


hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.

I think this version address all of the comments made. The parameterized form of the macro can be added when needed. Confirming LGTM.



================
Comment at: libcxx/include/__config:1444
+#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)")
----------------
Yes, I agree this is the better form (the effect of the packing is controlled by the argument, unlike the attribute, which accepts no arguments). The effect on the alignment of the members is mitigated with this form (if the parameter is not `1`).

If we need this parameterized in the future, the following works (even if `pack` is defined as a macro):
```
#define _LIBCPP_PACKED_FOR_AIX_IMPL(X) _Pragma( # X )
#define _LIBCPP_PACKED_FOR_AIX(X) _LIBCPP_PACKED_FOR_AIX_IMPL( pack( X ) )
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119567/new/

https://reviews.llvm.org/D119567



More information about the llvm-commits mailing list