lg2: compile time checking for reserved header names

Add compile time checking for reserved header names like 'MESSAGE' as
these would override the meaning at a journald level.

This bug was identified in the review of a phosphor-virtual-sensor
commit.

Example compile failure:

    ../virtualSensor.cpp:198:33:   in ‘constexpr’ expansion of
        ‘lg2::details::header_str("MESSAGE")’
    ../subprojects/phosphor-logging/lib/include/phosphor-logging/lg2/header.hpp:45:25:
        error: call to non-‘constexpr’ function ‘static void
        lg2::details::header_str::report_error(const char*)’
       45 |             report_error("Header name is reserved.");

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3a5c21fe25d307bf9b7fd296a71246a76d66872a
diff --git a/lib/include/phosphor-logging/lg2/header.hpp b/lib/include/phosphor-logging/lg2/header.hpp
index f767427..831bfc1 100644
--- a/lib/include/phosphor-logging/lg2/header.hpp
+++ b/lib/include/phosphor-logging/lg2/header.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <array>
 #include <phosphor-logging/lg2/concepts.hpp>
 #include <string_view>
 
@@ -34,6 +35,15 @@
                 "journald requires header may only contain underscore, "
                 "uppercase letters, or numbers ([_A-Z0-9]).");
         }
+
+        constexpr std::array reserved{
+            "CODE_FILE",   "CODE_FUNC", "CODE_LINE",
+            "LOG2_FMTMSG", "MESSAGE",   "PRIORITY",
+        };
+        if (std::ranges::find(reserved, value) != std::end(reserved))
+        {
+            report_error("Header name is reserved.");
+        }
     }
 
     /** Cast conversion back to (const char*). */