[clang] [Clang][Docs] Add documentation for -Wfortify-source (PR #224111)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 12:47:52 PDT 2026
================
@@ -1897,7 +1897,35 @@ def CrossTURemarks : DiagGroup<"ctu-remarks">;
def CTADMaybeUnsupported : DiagGroup<"ctad-maybe-unsupported">;
-def FortifySource : DiagGroup<"fortify-source", [FormatOverflow, FormatTruncation]>;
+def FortifySource : DiagGroup<"fortify-source", [FormatOverflow, FormatTruncation]> {
+ code Documentation = [{
+Warns at compile time when calls to standard C library or POSIX functions have
+provably out-of-bounds destination buffers or invalid constant arguments,
+modeled after [`_FORTIFY_SOURCE`](https://www.gnu.org/software/libc/manual/html_node/Source-Fortification.html)
----------------
AaronBallman wrote:
Totally fine to link to other docs, we do that pretty routinely for things like attributes. However, if our implementation deviates from those other docs, that should be spelled out explicitly. Also, we sometimes run into broken links from this and periodically need to find and fix those.
As for Shafik's request, he can clarify himself, but I took that to mean a dedicated section in the user's manual or a dedicated documentation page. The diagnostic reference documentation is often very concise and at some point we want to say a bit more than is likely to fit well there. That said, we might be able to start with documenting them in the diagnostic reference and then split out to a dedicated place once we have enough exposition to warrant it. Then again, the docs in this PR come awfully close already because my first thought when I looked at the changes was "do we have a Docs.td file for diagnostics so we can keep this out of DiagnosticGroups.td?" We do have DiagnosticDocs.td btw and I think we should probably move the documentation there if we don't decide to just go with a dedicated place up front.
https://github.com/llvm/llvm-project/pull/224111
More information about the cfe-commits
mailing list