Deprecate -fpack-struct for C++?

Giovanni Bajo giovannibajo@libero.it
Fri Feb 20 03:03:00 GMT 2004


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




More information about the Gcc mailing list