diff options
author | Sandra Loosemore <sloosemore@baylibre.com> | 2024-12-13 00:26:29 +0000 |
---|---|---|
committer | Sandra Loosemore <sloosemore@baylibre.com> | 2024-12-13 00:35:13 +0000 |
commit | d136fa00f0d5faff8397edcd7e4ebb3445ab21b0 (patch) | |
tree | 0fc6f69a90e453fb5df157008039f94c3b544efd /gcc | |
parent | 9946ab84cdff68ccda3d8dcc5898e0c36fe4e331 (diff) | |
download | gcc-d136fa00f0d5faff8397edcd7e4ebb3445ab21b0.zip gcc-d136fa00f0d5faff8397edcd7e4ebb3445ab21b0.tar.gz gcc-d136fa00f0d5faff8397edcd7e4ebb3445ab21b0.tar.bz2 |
Fix -fstrict-flex-arrays documentation, again [PR111659]
My previous attempt to fix this issue ended up garbling the text
instead. Trying again to make the descriptions of the attribute and
command-line option consistent.
gcc/ChangeLog
PR middle-end/111659
* doc/extend.texi (Common Variable Attributes): Copy-edit description
of the strict_flex_array attribute levels.
* doc/invoke.texi (C Dialect Options): Swap documented behavior for
levels 0 and 3. Copy the description for the other levels from the
attribute instead of indirecting to it.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/doc/extend.texi | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 20 |
2 files changed, 15 insertions, 9 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 12fe7bc..ebd9701 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -8328,11 +8328,11 @@ only when the trailing array is declared as a flexible array member per C99 standard onwards (@samp{[]}), it is treated as a flexible array member. There are two more levels in between 0 and 3, which are provided to -support older codes that use GCC zero-length array extension +support older code that uses the GCC zero-length array extension (@samp{[0]}) or one-element array as flexible array members (@samp{[1]}). When @var{level} is 1, the trailing array is treated as a flexible array member when it is declared as either @samp{[]}, -@samp{[0]}, or @samp{[1]}; When @var{level} is 2, the trailing array +@samp{[0]}, or @samp{[1]}. When @var{level} is 2, the trailing array is treated as a flexible array member when it is declared as either @samp{[]}, or @samp{[0]}. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 67a3c8f..0fdf850 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2980,16 +2980,22 @@ member for the purpose of accessing the elements of such an array. The value of @var{level} controls the level of strictness. @option{-fstrict-flex-arrays} is equivalent to -@option{-fstrict-flex-arrays=3}, which is the strictest; all -trailing arrays of structures are treated as flexible array members. +@option{-fstrict-flex-arrays=3}, which is the strictest; +a trailing array is treated as a flexible array member only when +it is declared as a flexible array member per C99 standard onwards. The negative form @option{-fno-strict-flex-arrays} is equivalent to @option{-fstrict-flex-arrays=0}, which is the least strict. In this -case a trailing array is treated as a flexible array member only when -it is declared as a flexible array member per C99 standard onwards. - -The possible values of @var{level} are the same as for the -@code{strict_flex_array} attribute (@pxref{Variable Attributes}). +case all trailing arrays of structures are treated as flexible array members. + +There are two more levels in between 0 and 3, which are provided to +support older code that uses the GCC zero-length array extension +(@samp{[0]}) or one-element array as flexible array members +(@samp{[1]}). When @var{level} is 1, the trailing array is treated as +a flexible array member when it is declared as either @samp{[]}, +@samp{[0]}, or @samp{[1]}. When @var{level} is 2, the trailing array +is treated as a flexible array member when it is declared as either +@samp{[]}, or @samp{[0]}. You can control this behavior for a specific trailing array field of a structure by using the variable attribute @code{strict_flex_array} attribute |