This is the mail archive of the gcc@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]

Deprecate -fpack-struct for C++?


Hello,

-fpack-struct cannot be used correctly in average C++ code. v3 is totally
incompatible with it (you can't even include the headers without getting a flow
of errors related to taking addresses/binding references to packed members of
classes) and the option does not discriminate between system headers and user
code. Plus, it triggers a segfault, see PR 14173. We have two options:

- Deprecate -fpack-struct for C++. I'd like to deprecate it in 3.4 and remove
it from mainline. I guess it's not so widespread for C++ given the above issues
anyway. And we are not losing any semantic power since we still have attribute
packed anyway.

- Fix -fpack-struct to affect only user structures, so that it becomes usable
somehow. This could be done checking if the structure is declared in system
headers, or checking if the enclosing namespace is std (assuming that v3 code
has to sit in namespace std anyway).

Comments?
Giovanni Bajo



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