phosphor-regulators: squash GCC dangling-reference warning
GCC 13 now includes a warning for possible dangling-references but the
warning currently has a good number of false positives. This is
discussed upstream in the GCC bugzilla[1,2] but the author seems to have
currently punted on handling many of these false positives and
recommends a pragma-disable. Do that for the time being so that the
code compiles on GCC 13.
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108165
[2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532
Fixes openbmc/phosphor-power#10.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie4ab428dcc8230645ee6ea3c331d8f3bbe47b9c8
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 05c5b60..1829e23 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -87,6 +87,8 @@
* @param element JSON element
* @param property property name
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-reference"
inline const nlohmann::json& getRequiredProperty(const nlohmann::json& element,
const std::string& property)
{
@@ -97,6 +99,7 @@
}
return *it;
}
+#pragma GCC diagnostic pop
/**
* Parses a JSON element containing an action.