[PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 11:51:37 PST 2016


ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

This patch fixes a warning that is issued when -Wpadded is on clang's command line. The following warning is from the build log of http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_abi/554/consoleText (note that I see this warning issued only from builders that use lib/buildit):

In file included from ../src/stdexcept.cpp:10:
../include/__refstring:30:12: warning: padding size of 'std::__1::__libcpp_refstring::_Rep_base' with 4 bytes to alignment boundary [-Wpadded]
    struct _Rep_base
           ^
1 warning generated.


http://reviews.llvm.org/D15897

Files:
  include/__refstring

Index: include/__refstring
===================================================================
--- include/__refstring
+++ include/__refstring
@@ -27,13 +27,21 @@
 
     typedef int count_t;
 
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
     struct _Rep_base
     {
         std::size_t len;
         std::size_t cap;
         count_t     count;
     };
 
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
     static
     _Rep_base*
     rep_from_data(const char *data_) _NOEXCEPT


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15897.44032.patch
Type: text/x-patch
Size: 560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160105/f1445fd1/attachment-0001.bin>


More information about the cfe-commits mailing list