From 0556d1cfe9be6df0aaee34c324f730a600a39fd5 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Wed, 6 May 2026 16:27:46 -0400 Subject: [PATCH] Diagnostics: Ensure state is initialized Tweak how we define the storage type for diagnostic state to ensure that the memory is always initialized. --- Source/cmDiagnostics.h | 6 +++++- Source/cmMakefile.cxx | 1 + Source/cmMessenger.cxx | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/cmDiagnostics.h b/Source/cmDiagnostics.h index 84fe098b48..6c9e7b49aa 100644 --- a/Source/cmDiagnostics.h +++ b/Source/cmDiagnostics.h @@ -101,7 +101,11 @@ public: cm::string_view name); /** Represent a set of diagnostic category actions. */ - using DiagnosticMap = std::array; + struct DiagnosticMap : public std::array + { + DiagnosticMap() + : array{} {}; + }; }; using cmDiagnosticCategory = cmDiagnostics::DiagnosticCategory; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11b54463e6..e2b454959b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -5,6 +5,7 @@ #include "cmMakefile.h" #include +#include #include #include #include diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index 1d5d41d7c2..cbfe69f3f8 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -3,6 +3,7 @@ #include "cmMessenger.h" #include +#include #include #include