From 77cc6e0a625bf5ede8381be3b211b708fd1ddf3a Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Fri, 2 Jun 2023 17:20:45 +0200
Subject: [PATCH] Revert "Fix compilation with fmtlib < 8"

This reverts a commit that was squashed in gaudi/Gaudi!1455
(a9a4cad97b6dad8309a9b4f37a04528dd21c0964).
---
 .../src/MessageSvc/MessageSvcSink.cpp         |  9 -------
 GaudiKernel/CMakeLists.txt                    |  1 -
 .../Gaudi/Accumulators/HistogramArray.h       |  5 +++-
 GaudiKernel/src/Lib/HistogramArray.cpp        | 25 -------------------
 GaudiKernel/src/Util/genconf.cpp              |  9 -------
 5 files changed, 4 insertions(+), 45 deletions(-)
 delete mode 100644 GaudiKernel/src/Lib/HistogramArray.cpp

diff --git a/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp b/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp
index 685fe0a5f7..1d005a34db 100644
--- a/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp
+++ b/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp
@@ -21,15 +21,6 @@
 #include <map>
 #include <string_view>
 
-#if FMT_VERSION < 80000
-namespace fmt {
-  template <typename T>
-  const T& runtime( const T& v ) {
-    return v;
-  }
-} // namespace fmt
-#endif
-
 namespace {
 
   /**
diff --git a/GaudiKernel/CMakeLists.txt b/GaudiKernel/CMakeLists.txt
index 54addec823..b78f3af81a 100644
--- a/GaudiKernel/CMakeLists.txt
+++ b/GaudiKernel/CMakeLists.txt
@@ -80,7 +80,6 @@ gaudi_add_library(GaudiKernel
           src/Lib/GaudiMain.cpp
           src/Lib/Guards.cpp
           src/Lib/HistoDef.cpp
-          src/Lib/HistogramArray.cpp
           src/Lib/HistoryObj.cpp
           src/Lib/IChronoStatSvc.cpp
           src/Lib/IConversionSvc.cpp
diff --git a/GaudiKernel/include/Gaudi/Accumulators/HistogramArray.h b/GaudiKernel/include/Gaudi/Accumulators/HistogramArray.h
index 9c99532e8e..5b06a78dd7 100644
--- a/GaudiKernel/include/Gaudi/Accumulators/HistogramArray.h
+++ b/GaudiKernel/include/Gaudi/Accumulators/HistogramArray.h
@@ -11,6 +11,9 @@
 #pragma once
 
 #include <Gaudi/Accumulators/Histogram.h>
+
+#include <fmt/format.h>
+
 #include <utility>
 
 namespace Gaudi::Accumulators {
@@ -24,7 +27,7 @@ namespace Gaudi::Accumulators {
     struct FormatHistDefault {
       std::string_view text;
       FormatHistDefault( std::string_view t ) : text{ t } {}
-      std::string operator()( size_t n );
+      auto operator()( size_t n ) { return fmt::format( fmt::runtime( text ), n ); }
     };
 
     /**
diff --git a/GaudiKernel/src/Lib/HistogramArray.cpp b/GaudiKernel/src/Lib/HistogramArray.cpp
deleted file mode 100644
index 880587d14e..0000000000
--- a/GaudiKernel/src/Lib/HistogramArray.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/***********************************************************************************\
-* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
-*                                                                                   *
-* This software is distributed under the terms of the Apache version 2 licence,     *
-* copied verbatim in the file "LICENSE".                                            *
-*                                                                                   *
-* In applying this licence, CERN does not waive the privileges and immunities       *
-* granted to it by virtue of its status as an Intergovernmental Organization        *
-* or submit itself to any jurisdiction.                                             *
-\***********************************************************************************/
-#include <Gaudi/Accumulators/HistogramArray.h>
-#include <fmt/format.h>
-
-#if FMT_VERSION < 80000
-namespace fmt {
-  template <typename T>
-  const T& runtime( const T& v ) {
-    return v;
-  }
-} // namespace fmt
-#endif
-
-std::string Gaudi::Accumulators::details::FormatHistDefault::operator()( size_t n ) {
-  return fmt::format( fmt::runtime( text ), n );
-}
diff --git a/GaudiKernel/src/Util/genconf.cpp b/GaudiKernel/src/Util/genconf.cpp
index d0bae498a9..a57b56f596 100644
--- a/GaudiKernel/src/Util/genconf.cpp
+++ b/GaudiKernel/src/Util/genconf.cpp
@@ -69,15 +69,6 @@
 #include <type_traits>
 #include <vector>
 
-#if FMT_VERSION < 80000
-namespace fmt {
-  template <typename T>
-  const T& runtime( const T& v ) {
-    return v;
-  }
-} // namespace fmt
-#endif
-
 namespace po = boost::program_options;
 namespace fs = boost::filesystem;
 
-- 
GitLab