public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2996] Add documentation for -Wflex-array-member-not-at-end.
@ 2023-08-04 14:24 Qing Zhao
  0 siblings, 0 replies; only message in thread
From: Qing Zhao @ 2023-08-04 14:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:44e3f39a3d5f08ac4129c0558a90e297d2dd1e30

commit r14-2996-g44e3f39a3d5f08ac4129c0558a90e297d2dd1e30
Author: Qing Zhao <qing.zhao@oracle.com>
Date:   Fri Aug 4 14:24:32 2023 +0000

    Add documentation for -Wflex-array-member-not-at-end.
    
    '-Wflex-array-member-not-at-end (C and C++ only)'
         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.

Diff:
---
 gcc/doc/invoke.texi | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index adb10a3528d..674f956f4b8 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 @r{(C and C++ only)}
+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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-04 14:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-04 14:24 [gcc r14-2996] Add documentation for -Wflex-array-member-not-at-end 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).