<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -Wpadded may be split in two options"
   href="http://llvm.org/bugs/show_bug.cgi?id=22442">22442</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wpadded may be split in two options
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>guillaum.bouchard@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hello.

-Wpadded warns about two issues, padding a struct field and padding at the end
(i.e: the whole struct). See the example:

-------------------
struct Bidule
{
    char b;
    int a;
    char c;
};

--->

test.cpp:4:6: warning: padding struct 'Bidule' with 3 bytes to align 'a'
[-Wpadded]
        int a;
            ^
test.cpp:1:8: warning: padding size of 'Bidule' with 3 bytes to alignment
boundary [-Wpadded]
struct Bidule
--------------------------


Usually padding in the middle is a bad thing because the struct can be "easily"
organized differently to reduce the memory footprint. On the other hand,
padding at the end of a structure is common and there is usually no trivial
fix.

As an example, I ran -Wpadded on a large code base, I found 3 padding of field
which I fixed, and more than one thousand warning messages about padding of
struct for which I cannot do something without complex code refactoring.

It may be possible to split -Wpadding in two options, one which warns about
padding fields (which I found really useful 100% of the time) and the other
which warns about padding the whole struct, which IMHO only need to be
activated when needed.

Thank you.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>