-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Document -fstrict-flex-arrays option #138388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang Author: None (serge-sans-paille) ChangesFix #138185 Full diff: https://github.com/llvm/llvm-project/pull/138388.diff 1 Files Affected:
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 2946ffaa28da0..5ceba7e3bf4c7 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1554,7 +1554,10 @@ def fstrict_flex_arrays_EQ : Joined<["-"], "fstrict-flex-arrays=">, Group<f_Grou
Visibility<[ClangOption, CC1Option]>,
NormalizedValuesScope<"LangOptions::StrictFlexArraysLevelKind">,
NormalizedValues<["Default", "OneZeroOrIncomplete", "ZeroOrIncomplete", "IncompleteOnly"]>,
- HelpText<"Enable optimizations based on the strict definition of flexible arrays">,
+ HelpText<"Enable optimizations based on the strict definition of flexible arrays. "
+ "If ``<n>`` is equal to 0, any trailing array member is considered a flexible array. "
+ "If ``<n>`` is equal to 1, trailing array members of size 0, 1 and undefined are considered flexible arrays. "
+ "If ``<n>`` is equal to 3, only trailing array members of undefined size are considered flexible arrays.">,
MarshallingInfoEnum<LangOpts<"StrictFlexArraysLevel">, "Default">;
defm apple_pragma_pack : BoolFOption<"apple-pragma-pack",
LangOpts<"ApplePragmaPack">, DefaultFalse,
|
@zygoloid this restores (and hopefully improves) the original documentation. The values and behavior are obviously the same as gcc. I don't have a strong opinion on value aliases. |
@@ -1554,7 +1554,10 @@ def fstrict_flex_arrays_EQ : Joined<["-"], "fstrict-flex-arrays=">, Group<f_Grou | |||
Visibility<[ClangOption, CC1Option]>, | |||
NormalizedValuesScope<"LangOptions::StrictFlexArraysLevelKind">, | |||
NormalizedValues<["Default", "OneZeroOrIncomplete", "ZeroOrIncomplete", "IncompleteOnly"]>, | |||
HelpText<"Enable optimizations based on the strict definition of flexible arrays">, | |||
HelpText<"Enable optimizations based on the strict definition of flexible arrays. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much too long to include in the --help
output. Maybe this could be specified as DocBrief
instead soon it goes into the command-line reference but not --help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I wasn't aware of DocBreef, that's indeed much better like this.
HelpText<"Enable optimizations based on the strict definition of flexible arrays. " | ||
"If ``<n>`` is equal to 0, any trailing array member is considered a flexible array. " | ||
"If ``<n>`` is equal to 1, trailing array members of size 0, 1 and undefined are considered flexible arrays. " | ||
"If ``<n>`` is equal to 3, only trailing array members of undefined size are considered flexible arrays.">, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about 2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oopsie. Fixed
fae4db4
to
39cf81c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Thank you for the quick turnaround on the documentation! |
Fix #138185