Skip to content

Commit

Permalink
Add documentation for -Wflex-array-member-not-at-end.
Browse files Browse the repository at this point in the history
'-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.
  • Loading branch information
qingzhao69 committed Aug 4, 2023
1 parent abf9530 commit 44e3f39
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gcc/doc/invoke.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 44e3f39

Please sign in to comment.