public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add documentation for -Wflex-array-member-not-at-end.
@ 2023-08-03 16:31 Qing Zhao
  2023-08-03 17:29 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Qing Zhao @ 2023-08-03 16:31 UTC (permalink / raw)
  To: richard.guenther, joseph; +Cc: gcc-patches, Qing Zhao

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(+)

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
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add documentation for -Wflex-array-member-not-at-end.
  2023-08-03 16:31 [PATCH] Add documentation for -Wflex-array-member-not-at-end Qing Zhao
@ 2023-08-03 17:29 ` Joseph Myers
  2023-08-04 14:26   ` Qing Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2023-08-03 17:29 UTC (permalink / raw)
  To: Qing Zhao; +Cc: richard.guenther, gcc-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add documentation for -Wflex-array-member-not-at-end.
  2023-08-03 17:29 ` Joseph Myers
@ 2023-08-04 14:26   ` Qing Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Qing Zhao @ 2023-08-04 14:26 UTC (permalink / raw)
  To: Joseph Myers; +Cc: richard.guenther, gcc-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-04 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03 16:31 [PATCH] Add documentation for -Wflex-array-member-not-at-end Qing Zhao
2023-08-03 17:29 ` Joseph Myers
2023-08-04 14:26   ` Qing Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).