[V2][PATCH] gcc-14/changes.html: Deprecate a GCC C extension on flexible array members.
Qing Zhao
qing.zhao@oracle.com
Tue May 7 20:14:58 GMT 2024
(Resend since my previous email in HTML and inline quoting wasn’t work, I changed the mail setting, hopefully this time it’s good). Sorry for the inconvenience.
> On May 7, 2024, at 13:57, Sebastian Huber <sebastian.huber@embedded-brains.de> wrote:
>
> On 07.05.24 16:26, Qing Zhao wrote:
>> Hi, Sebastian,
>> Thanks for your explanation.
>> Our goal is to deprecate the GCC extension on structure containing a flexible array member not at the end of another structure. In order to achieve this goal, we provided the warning option -Wflex-array-member-not-at-end for the users to
>> locate all such cases in their source code and update the source code to eliminate such cases.
>
> What is the benefit of deprecating this GCC extension? If GCC extensions are removed, then it would be nice to enable the associated warnings by default.
We had a long discussion before deciding to deprecating this GCC extension. Please see details here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832
Yes, we do plan to enable this warning by default before final deprecation. (Might consider to enable this warning by default in GCC15… and then deprecate it in the next release)
Right now, there is an ongoing work in Linux kernel to get rid of all such cases. Kees might have more information on this.
>
>> The static initialization of structures with flexible array members will still work as long as the flexible array members are at
>> the end of the structures.
>
> Removing the support for flexible array members in the middle of compounds will make the static initialization practically infeasible.
If the flexible array member is moved to the end of the compounds, the static initialization still work. What’s the issue here?
>
>> My question: is it possible to update your source code to move the structure with flexible array member to the end of the
>> containing structure?
>> i.e, in your example, in the struct Thread_Configured_control, move the field “Thread_Control Control” to the end of the structure?
>
> If we move the Thread_Control to the end, how would I add a configuration defined number of elements at the end?
Don’t understand this, why moving the Thread_Control Control” to the end of the containing structure will make this a problem?
Could you please explain this with a simplified example?
Thanks.
Qing
>
> --
> embedded brains GmbH & Co. KG
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax: +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
More information about the Gcc-patches
mailing list