This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/53514] New: Make -Wpadded a meta-option for -Wpadded-in-middle and -Wpadded-at-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53514

             Bug #: 53514
           Summary: Make -Wpadded a meta-option for -Wpadded-in-middle and
                    -Wpadded-at-end
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: david@doublewise.net


"Warn if padding is included in a structure, either to align an element of the
structure or to align the whole structure. Sometimes when this happens it is
possible to rearrange the fields of the structure to reduce the padding and so
make the structure smaller."

I would find this warning much more useful if it were two different warnings,
-Wpadded-in-middle and -Wpadded-at-end.

-Wpadded-at-end would only warn if padding was added to the end of the
structure. This could theoretically be useful to let you know about structures
that you can add data to "for free" in terms of size.

What I'm more interested in, however, is -Wpadded-in-middle. This is what
suggests that perhaps you could reduce the size of the structure by changing
the order of the elements.

This suggestion would make -Wpadded become equivalent to -Wpadded-in-middle
-Wpadded-at-end.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]