[clang] [clang] Document -Wglobal-constructors behavior (PR #68084)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 03:16:27 PDT 2023


https://github.com/serge-sans-paille created https://github.com/llvm/llvm-project/pull/68084

It's a drop in the ocean considering the lack of documentation of our diagnostics, but it's a start.

>From 9d8da7e0221ec408db68d84f3edd4aec58883eb1 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 3 Oct 2023 10:54:14 +0200
Subject: [PATCH] [clang] Document -Wglobal-constructors behavior

It's a drop in the ocean considering the lack of documentation of our
diagnostics, but it's a start.
---
 clang/include/clang/Basic/DiagnosticGroups.td | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 0b09c002191848a..55e15e68764c42b 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -416,7 +416,11 @@ def : DiagGroup<"c++2a-compat-pedantic", [CXX20CompatPedantic]>;
 def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
 def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
 def FourByteMultiChar : DiagGroup<"four-char-constants">;
-def GlobalConstructors : DiagGroup<"global-constructors">;
+def GlobalConstructors : DiagGroup<"global-constructors"> {
+ code Documentation = [{
+Emit a warning for each variable declaration that generates code run at startup.
+ }];
+}
 def BitwiseConditionalParentheses: DiagGroup<"bitwise-conditional-parentheses">;
 def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">;
 def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">;



More information about the cfe-commits mailing list