Add documentation for -Wflex-array-member-not-at-end.

Message ID 20230803163117.1016079-1-qing.zhao@oracle.com
State Accepted
Headers
Series Add documentation for -Wflex-array-member-not-at-end. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Qing Zhao Aug. 3, 2023, 4:31 p.m. UTC
  When adding the option -Wflex-array-member-not-at-end in the commit
https://gcc.gnu.org/pipermail/gcc-cvs/2023-June/385730.html

the documentation for this new option was missing.

This patch is to add the documentation for this warning option.

bootstrapped and also checked the documentation, no issue.

Okay for committing?

thanks.

Qing

==============================


'-Wflex-array-member-not-at-end'
     Warn when a structure containing a C99 flexible array member as the
     last field is not at the end of another structure.  This warning
     warns e.g.  about

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

gcc/ChangeLog:

	* doc/invoke.texi (-Wflex-array-member-not-at-end): Document
	new option.
---
 gcc/doc/invoke.texi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
  

Comments

Joseph Myers Aug. 3, 2023, 5:29 p.m. UTC | #1
On Thu, 3 Aug 2023, Qing Zhao via Gcc-patches wrote:

> +@opindex Wflex-array-member-not-at-end
> +@opindex Wno-flex-array-member-not-at-end
> +@item -Wflex-array-member-not-at-end

I'd expect this to have @r{(C and C++ only)} to indicate what languages 
the option applies to.  OK with that change.
  
Qing Zhao Aug. 4, 2023, 2:26 p.m. UTC | #2
Thanks.

I just updated the doc per your suggestion and committed as:

https://gcc.gnu.org/pipermail/gcc-cvs/2023-August/387588.html

Qing
> On Aug 3, 2023, at 1:29 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> 
> On Thu, 3 Aug 2023, Qing Zhao via Gcc-patches wrote:
> 
>> +@opindex Wflex-array-member-not-at-end
>> +@opindex Wno-flex-array-member-not-at-end
>> +@item -Wflex-array-member-not-at-end
> 
> I'd expect this to have @r{(C and C++ only)} to indicate what languages 
> the option applies to.  OK with that change.
> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com
  

Patch

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index adb10a3528da..0e7d827d355f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -357,6 +357,7 @@  Objective-C and Objective-C++ Dialects}.
 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
 -Wenum-int-mismatch
 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
+-Wflex-array-member-not-at-end
 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
 -Wno-format-contains-nul  -Wno-format-extra-args
 -Wformat-nonliteral  -Wformat-overflow=@var{n}
@@ -9312,6 +9313,18 @@  value, like assigning a signed integer expression to an unsigned
 integer variable. An explicit cast silences the warning. In C, this
 option is enabled also by @option{-Wconversion}.
 
+@opindex Wflex-array-member-not-at-end
+@opindex Wno-flex-array-member-not-at-end
+@item -Wflex-array-member-not-at-end
+Warn when a structure containing a C99 flexible array member as the last
+field is not at the end of another structure.
+This warning warns e.g. about
+
+@smallexample
+struct flex  @{ int length; char data[]; @};
+struct mid_flex @{ int m; struct flex flex_data; int n; @};
+@end smallexample
+
 @opindex Wfloat-conversion
 @opindex Wno-float-conversion
 @item -Wfloat-conversion