gcc-14/changes.html: Deprecate a GCC C extension on flexible array members.

Message ID 20230710191138.1534922-1-qing.zhao@oracle.com
State Unresolved
Headers
Series gcc-14/changes.html: Deprecate a GCC C extension on flexible array members. |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Qing Zhao July 10, 2023, 7:11 p.m. UTC
  Hi,

This is the change for the GCC14 releaes Notes on the deprecating of a C
extension about flexible array members.

Okay for committing?

thanks.

Qing

========

*htdocs/gcc-14/changes.html (Caveats): Add notice about deprecating a C
extension about flexible array members.
---
 htdocs/gcc-14/changes.html | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Comments

Qing Zhao Aug. 2, 2023, 6:50 p.m. UTC | #1
Ping…

thanks.

Qing

> On Jul 10, 2023, at 3:11 PM, Qing Zhao <qing.zhao@oracle.com> wrote:
> 
> Hi,
> 
> This is the change for the GCC14 releaes Notes on the deprecating of a C
> extension about flexible array members.
> 
> Okay for committing?
> 
> thanks.
> 
> Qing
> 
> ========
> 
> *htdocs/gcc-14/changes.html (Caveats): Add notice about deprecating a C
> extension about flexible array members.
> ---
> htdocs/gcc-14/changes.html | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
> index 3f797642..c7f2ce4d 100644
> --- a/htdocs/gcc-14/changes.html
> +++ b/htdocs/gcc-14/changes.html
> @@ -30,7 +30,15 @@ a work-in-progress.</p>
> <!-- .................................................................. -->
> <h2>Caveats</h2>
> <ul>
> -  <li>...</li>
> +  <li><strong>C:</strong>
> +      Support for the GCC extension, a structure containing a C99 flexible array
> +      member, or a union containing such a structure, is not the last field of
> +      another structure, is deprecated. Refer to
> +      <a href="https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html">
> +      Zero Length Arrays</a>.
> +      Any code relying on this extension should be modifed to ensure that
> +      C99 flexible array members only end up at the ends of structures.
> +  </li>
> </ul>
> 
> 
> -- 
> 2.31.1
>
  
Richard Biener Aug. 3, 2023, 7:10 a.m. UTC | #2
On Mon, Jul 10, 2023 at 9:12 PM Qing Zhao via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> This is the change for the GCC14 releaes Notes on the deprecating of a C
> extension about flexible array members.
>
> Okay for committing?
>
> thanks.
>
> Qing
>
> ========
>
> *htdocs/gcc-14/changes.html (Caveats): Add notice about deprecating a C
> extension about flexible array members.
> ---
>  htdocs/gcc-14/changes.html | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
> index 3f797642..c7f2ce4d 100644
> --- a/htdocs/gcc-14/changes.html
> +++ b/htdocs/gcc-14/changes.html
> @@ -30,7 +30,15 @@ a work-in-progress.</p>
>  <!-- .................................................................. -->
>  <h2>Caveats</h2>
>  <ul>
> -  <li>...</li>
> +  <li><strong>C:</strong>
> +      Support for the GCC extension, a structure containing a C99 flexible array
> +      member, or a union containing such a structure, is not the last field of
> +      another structure, is deprecated. Refer to
> +      <a href="https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html">
> +      Zero Length Arrays</a>.
> +      Any code relying on this extension should be modifed to ensure that
> +      C99 flexible array members only end up at the ends of structures.

If it's deprecated any use should be diagnosed by default with a
warning, can you
mention that and make sure we do so?  What would be the most surprising
example of code that's going to be rejected?

Richard.

> +  </li>
>  </ul>
>
>
> --
> 2.31.1
>
  
Qing Zhao Aug. 3, 2023, 3:02 p.m. UTC | #3
> On Aug 3, 2023, at 3:10 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On Mon, Jul 10, 2023 at 9:12 PM Qing Zhao via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>> 
>> Hi,
>> 
>> This is the change for the GCC14 releaes Notes on the deprecating of a C
>> extension about flexible array members.
>> 
>> Okay for committing?
>> 
>> thanks.
>> 
>> Qing
>> 
>> ========
>> 
>> *htdocs/gcc-14/changes.html (Caveats): Add notice about deprecating a C
>> extension about flexible array members.
>> ---
>> htdocs/gcc-14/changes.html | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
>> index 3f797642..c7f2ce4d 100644
>> --- a/htdocs/gcc-14/changes.html
>> +++ b/htdocs/gcc-14/changes.html
>> @@ -30,7 +30,15 @@ a work-in-progress.</p>
>> <!-- .................................................................. -->
>> <h2>Caveats</h2>
>> <ul>
>> -  <li>...</li>
>> +  <li><strong>C:</strong>
>> +      Support for the GCC extension, a structure containing a C99 flexible array
>> +      member, or a union containing such a structure, is not the last field of
>> +      another structure, is deprecated. Refer to
>> +      <a href="https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html">
>> +      Zero Length Arrays</a>.
>> +      Any code relying on this extension should be modifed to ensure that
>> +      C99 flexible array members only end up at the ends of structures.
> 
> If it's deprecated any use should be diagnosed by default with a
> warning, can you
> mention that and make sure we do so?

I have added such warning option: -Wflex-array-member-not-at-end
In commit https://gcc.gnu.org/pipermail/gcc-cvs/2023-June/385730.html

I should add this warning option to the release notes. I will do that.


Another thing is, I just realized that the doc of this new option is missing from the invoke.texi.

I will send a new patch for the documentation of this new option first.

>  What would be the most surprising
> example of code that's going to be rejected?

             struct flex  { int length; char data[]; };
    
              struct mid_flex { int m; struct flex flex_data; int n; };

The above example, the 2nd structure mid_flex will be warned.

Qing
 
> 
> Richard.
> 
>> +  </li>
>> </ul>
>> 
>> 
>> --
>> 2.31.1
  

Patch

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index 3f797642..c7f2ce4d 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -30,7 +30,15 @@  a work-in-progress.</p>
 <!-- .................................................................. -->
 <h2>Caveats</h2>
 <ul>
-  <li>...</li>
+  <li><strong>C:</strong>
+      Support for the GCC extension, a structure containing a C99 flexible array
+      member, or a union containing such a structure, is not the last field of
+      another structure, is deprecated. Refer to
+      <a href="https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html">
+      Zero Length Arrays</a>.
+      Any code relying on this extension should be modifed to ensure that
+      C99 flexible array members only end up at the ends of structures.
+  </li>
 </ul>