[Openmp-commits] [openmp] [OpenMP] Fix set-but-unused-var warning in omptest (PR #196069)

Jan Patrick Lehr via Openmp-commits openmp-commits at lists.llvm.org
Thu May 7 01:51:20 PDT 2026


================
@@ -0,0 +1,38 @@
+//===- EnvHelper.h - General logging class ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Provides environment helpers shared between a couple of places.
+///
+//===----------------------------------------------------------------------===//
+
+#include <optional>
+
+#ifndef OPENMP_TOOLS_OMPTEST_INCLUDE_ENVHELPER_H
+#define OPENMP_TOOLS_OMPTEST_INCLUDE_ENVHELPER_H
+
+namespace omptest {
+/// Load the value of a given boolean environmental variable. Return
+/// std::nullopt if not specified in the environment.
+inline std::optional<bool>
----------------
jplehr wrote:

The intention is to return false only if explicitly set in the environment and nullopt if not set. This is, I think, different cases. The `Logger` constructor will take then the ctor default value in the nullopt case.

If it is not doing that, then I made a mistake. :)

https://github.com/llvm/llvm-project/pull/196069


More information about the Openmp-commits mailing list