File 0004-expression-is-not-const.patch of Package arangodb3

From 4a758e33d48913539e263fb5baccf8034abd6818 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@gmail.com>
Date: Wed, 8 Mar 2023 11:32:32 +0100
Subject: [PATCH 4/7] expression is not const
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

according to gcc 12

gcc also thinks 'constexpr' call flows off the end of the function

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
---
 arangod/FeaturePhases/BasicFeaturePhaseServer.cpp  | 12 ++++++------
 arangod/FeaturePhases/DatabaseFeaturePhase.cpp     |  2 +-
 arangod/GeneralServer/AuthenticationFeature.cpp    |  2 +-
 arangod/RestServer/DatabasePathFeature.cpp         |  2 +-
 arangod/RestServer/ServerFeature.cpp               |  4 ++--
 arangod/RestServer/UpgradeFeature.cpp              |  4 ++--
 arangod/RestServer/arangod.cpp                     |  2 +-
 arangod/Scheduler/SchedulerFeature.cpp             |  2 +-
 client-tools/Dump/DumpFeature.cpp                  |  4 ++--
 .../FeaturePhases/BasicFeaturePhaseClient.h        |  8 ++++----
 client-tools/Shell/ClientFeature.h                 |  2 +-
 lib/ApplicationFeatures/ApplicationServer.h        | 14 +++++++-------
 lib/Basics/TypeList.h                              |  6 +++---
 13 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/arangod/FeaturePhases/BasicFeaturePhaseServer.cpp b/arangod/FeaturePhases/BasicFeaturePhaseServer.cpp
index 03cff8e00a4..889f22477fb 100644
--- a/arangod/FeaturePhases/BasicFeaturePhaseServer.cpp
+++ b/arangod/FeaturePhases/BasicFeaturePhaseServer.cpp
@@ -31,10 +31,10 @@ BasicFeaturePhaseServer::BasicFeaturePhaseServer(ArangodServer& server)
   setOptional(false);
   startsAfter<GreetingsFeaturePhase, ArangodServer>();
 
-  if constexpr (ArangodServer::contains<DaemonFeature>()) {
+  if (ArangodServer::contains<DaemonFeature>()) {
     startsAfter<DaemonFeature, ArangodServer>();
   }
-  if constexpr (ArangodServer::contains<SupervisorFeature>()) {
+  if (ArangodServer::contains<SupervisorFeature>()) {
     startsAfter<SupervisorFeature, ArangodServer>();
   }
   startsAfter<CpuUsageFeature, ArangodServer>();
@@ -50,16 +50,16 @@ BasicFeaturePhaseServer::BasicFeaturePhaseServer(ArangodServer& server)
   startsAfter<SslFeature, ArangodServer>();
   startsAfter<TempFeature, ArangodServer>();
 
-  if constexpr (ArangodServer::contains<FileDescriptorsFeature>()) {
+  if (ArangodServer::contains<FileDescriptorsFeature>()) {
     startsAfter<FileDescriptorsFeature, ArangodServer>();
   }
-  if constexpr (ArangodServer::contains<WindowsServiceFeature>()) {
+  if (ArangodServer::contains<WindowsServiceFeature>()) {
     startsAfter<WindowsServiceFeature, ArangodServer>();
   }
-  if constexpr (ArangodServer::contains<AuditFeature>()) {
+  if (ArangodServer::contains<AuditFeature>()) {
     startsAfter<AuditFeature, ArangodServer>();
   }
-  if constexpr (ArangodServer::contains<EncryptionFeature>()) {
+  if (ArangodServer::contains<EncryptionFeature>()) {
     startsAfter<EncryptionFeature, ArangodServer>();
   }
 }
diff --git a/arangod/FeaturePhases/DatabaseFeaturePhase.cpp b/arangod/FeaturePhases/DatabaseFeaturePhase.cpp
index 8d331d53a42..436a8eed581 100644
--- a/arangod/FeaturePhases/DatabaseFeaturePhase.cpp
+++ b/arangod/FeaturePhases/DatabaseFeaturePhase.cpp
@@ -48,7 +48,7 @@ DatabaseFeaturePhase::DatabaseFeaturePhase(ArangodServer& server)
   startsAfter<transaction::ManagerFeature, ArangodServer>();
   startsAfter<ViewTypesFeature, ArangodServer>();
 
-  if constexpr (ArangodServer::contains<LdapFeature>()) {
+  if (ArangodServer::contains<LdapFeature>()) {
     startsAfter<LdapFeature, ArangodServer>();
   }
 }
diff --git a/arangod/GeneralServer/AuthenticationFeature.cpp b/arangod/GeneralServer/AuthenticationFeature.cpp
index c6133c0582e..f52dd7fe483 100644
--- a/arangod/GeneralServer/AuthenticationFeature.cpp
+++ b/arangod/GeneralServer/AuthenticationFeature.cpp
@@ -64,7 +64,7 @@ AuthenticationFeature::AuthenticationFeature(Server& server)
   setOptional(false);
   startsAfter<application_features::BasicFeaturePhaseServer>();
 
-  if constexpr (Server::contains<LdapFeature>()) {
+  if (Server::contains<LdapFeature>()) {
     startsAfter<LdapFeature>();
   }
 }
diff --git a/arangod/RestServer/DatabasePathFeature.cpp b/arangod/RestServer/DatabasePathFeature.cpp
index cf5007b895d..62d4f85c9ca 100644
--- a/arangod/RestServer/DatabasePathFeature.cpp
+++ b/arangod/RestServer/DatabasePathFeature.cpp
@@ -48,7 +48,7 @@ DatabasePathFeature::DatabasePathFeature(Server& server)
   setOptional(false);
   startsAfter<GreetingsFeaturePhase>();
 
-  if constexpr (Server::contains<FileDescriptorsFeature>()) {
+  if (Server::contains<FileDescriptorsFeature>()) {
     startsAfter<FileDescriptorsFeature>();
   }
   startsAfter<LanguageFeature>();
diff --git a/arangod/RestServer/ServerFeature.cpp b/arangod/RestServer/ServerFeature.cpp
index b89294170de..9dd198a1a38 100644
--- a/arangod/RestServer/ServerFeature.cpp
+++ b/arangod/RestServer/ServerFeature.cpp
@@ -204,10 +204,10 @@ void ServerFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
   }
 
   auto disableDeamonAndSupervisor = [&]() {
-    if constexpr (Server::contains<DaemonFeature>()) {
+    if (Server::contains<DaemonFeature>()) {
       server().disableFeatures(std::array{Server::id<DaemonFeature>()});
     }
-    if constexpr (Server::contains<SupervisorFeature>()) {
+    if (Server::contains<SupervisorFeature>()) {
       server().disableFeatures(std::array{Server::id<SupervisorFeature>()});
     }
   };
diff --git a/arangod/RestServer/UpgradeFeature.cpp b/arangod/RestServer/UpgradeFeature.cpp
index 0bd8f3fbf54..0b7c8bfb29a 100644
--- a/arangod/RestServer/UpgradeFeature.cpp
+++ b/arangod/RestServer/UpgradeFeature.cpp
@@ -147,10 +147,10 @@ void UpgradeFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
   // in the way...
   if (ServerState::instance()->isCoordinator()) {
     auto disableDaemonAndSupervisor = [&]() {
-      if constexpr (Server::contains<DaemonFeature>()) {
+      if (Server::contains<DaemonFeature>()) {
         server().forceDisableFeatures(std::array{Server::id<DaemonFeature>()});
       }
-      if constexpr (Server::contains<SupervisorFeature>()) {
+      if (Server::contains<SupervisorFeature>()) {
         server().forceDisableFeatures(
             std::array{Server::id<SupervisorFeature>()});
       }
diff --git a/arangod/RestServer/arangod.cpp b/arangod/RestServer/arangod.cpp
index 5f10d8c8395..a286b868f30 100644
--- a/arangod/RestServer/arangod.cpp
+++ b/arangod/RestServer/arangod.cpp
@@ -36,7 +36,7 @@
 using namespace arangodb;
 using namespace arangodb::application_features;
 
-constexpr auto kNonServerFeatures =
+auto kNonServerFeatures =
     std::array{ArangodServer::id<ActionFeature>(),
                ArangodServer::id<AgencyFeature>(),
                ArangodServer::id<ClusterFeature>(),
diff --git a/arangod/Scheduler/SchedulerFeature.cpp b/arangod/Scheduler/SchedulerFeature.cpp
index 4158468554e..79f8f8becab 100644
--- a/arangod/Scheduler/SchedulerFeature.cpp
+++ b/arangod/Scheduler/SchedulerFeature.cpp
@@ -90,7 +90,7 @@ SchedulerFeature::SchedulerFeature(Server& server)
     : ArangodFeature{server, *this}, _scheduler(nullptr) {
   setOptional(false);
   startsAfter<GreetingsFeaturePhase>();
-  if constexpr (Server::contains<FileDescriptorsFeature>()) {
+  if (Server::contains<FileDescriptorsFeature>()) {
     startsAfter<FileDescriptorsFeature>();
   }
 }
diff --git a/client-tools/Dump/DumpFeature.cpp b/client-tools/Dump/DumpFeature.cpp
index 4b157787a71..27469520bdd 100644
--- a/client-tools/Dump/DumpFeature.cpp
+++ b/client-tools/Dump/DumpFeature.cpp
@@ -866,7 +866,7 @@ Result DumpFeature::runDump(httpclient::SimpleHttpClient& client,
         << "Dumping database '" << dbName << "' (" << dbId << ")";
 
     EncryptionFeature* encryption{};
-    if constexpr (Server::contains<EncryptionFeature>()) {
+    if (Server::contains<EncryptionFeature>()) {
       if (server().hasFeature<EncryptionFeature>()) {
         encryption = &server().getFeature<EncryptionFeature>();
       }
@@ -1151,7 +1151,7 @@ void DumpFeature::start() {
   double const start = TRI_microtime();
 
   EncryptionFeature* encryption{};
-  if constexpr (Server::contains<EncryptionFeature>()) {
+  if (Server::contains<EncryptionFeature>()) {
     if (server().hasFeature<EncryptionFeature>()) {
       encryption = &server().getFeature<EncryptionFeature>();
     }
diff --git a/client-tools/FeaturePhases/BasicFeaturePhaseClient.h b/client-tools/FeaturePhases/BasicFeaturePhaseClient.h
index 6bba5abff33..251bb873005 100644
--- a/client-tools/FeaturePhases/BasicFeaturePhaseClient.h
+++ b/client-tools/FeaturePhases/BasicFeaturePhaseClient.h
@@ -42,16 +42,16 @@ class BasicFeaturePhaseClient : public ApplicationFeaturePhase {
   explicit BasicFeaturePhaseClient(Server& server)
       : ApplicationFeaturePhase(server, *this) {
     setOptional(false);
-    if constexpr (Server::template contains<GreetingsFeaturePhase>()) {
+    if (Server::template contains<GreetingsFeaturePhase>()) {
       startsAfter<GreetingsFeaturePhase, Server>();
     }
-    if constexpr (Server::template contains<EncryptionFeature>()) {
+    if (Server::template contains<EncryptionFeature>()) {
       startsAfter<EncryptionFeature, Server>();
     }
-    if constexpr (Server::template contains<SslFeature>()) {
+    if (Server::template contains<SslFeature>()) {
       startsAfter<SslFeature, Server>();
     }
-    if constexpr (Server::template contains<HttpEndpointProvider>()) {
+    if (Server::template contains<HttpEndpointProvider>()) {
       startsAfter<HttpEndpointProvider, Server>();
     }
   }
diff --git a/client-tools/Shell/ClientFeature.h b/client-tools/Shell/ClientFeature.h
index f5a561b27a5..7462cddf973 100644
--- a/client-tools/Shell/ClientFeature.h
+++ b/client-tools/Shell/ClientFeature.h
@@ -64,7 +64,7 @@ class ClientFeature final : public HttpEndpointProvider {
     static_assert(Server::template isCreatedAfter<HttpEndpointProvider,
                                                   CommunicationFeaturePhase>());
 
-    if constexpr (Server::template contains<ShellConsoleFeature>()) {
+    if (Server::template contains<ShellConsoleFeature>()) {
       static_assert(Server::template isCreatedAfter<HttpEndpointProvider,
                                                     ShellConsoleFeature>());
       _console = &server.template getFeature<ShellConsoleFeature>();
diff --git a/lib/ApplicationFeatures/ApplicationServer.h b/lib/ApplicationFeatures/ApplicationServer.h
index 7f681fc03c6..711140f5169 100644
--- a/lib/ApplicationFeatures/ApplicationServer.h
+++ b/lib/ApplicationFeatures/ApplicationServer.h
@@ -380,20 +380,20 @@ class ApplicationServerT : public ApplicationServer {
  public:
   // Returns feature identifier.
   template<typename T>
-  static constexpr size_t id() noexcept {
+  static size_t id() noexcept {
     return Features::template id<T>();
   }
 
   // Returns true if a feature denoted by `T` is registered with the server.
   template<typename T>
-  static constexpr bool contains() noexcept {
+  static bool contains() noexcept {
     return Features::template contains<T>();
   }
 
   // Returns true if a feature denoted by `Feature` is created before other
   // feautures denoted by `OtherFeatures`.
   template<typename Feature, typename... OtherFeatures>
-  static constexpr bool isCreatedAfter() noexcept {
+  static bool isCreatedAfter() noexcept {
     return (std::greater{}(id<Feature>(), id<OtherFeatures>()) && ...);
   }
 
@@ -406,7 +406,7 @@ class ApplicationServerT : public ApplicationServer {
   void addFeatures(Initializer&& initializer) {
     Features::visit([&]<typename T>(TypeTag<T>) {
       static_assert(std::is_base_of_v<ApplicationFeature, T>);
-      constexpr auto featureId = Features::template id<T>();
+      auto featureId = Features::template id<T>();
 
       TRI_ASSERT(!hasFeature<T>());
       _features[featureId] =
@@ -424,7 +424,7 @@ class ApplicationServerT : public ApplicationServer {
     static_assert(std::is_base_of_v<ApplicationFeature, Type>);
     static_assert(std::is_base_of_v<ApplicationFeature, Impl>);
     static_assert(std::is_base_of_v<Type, Impl>);
-    constexpr auto featureId = Features::template id<Type>();
+    auto featureId = Features::template id<Type>();
 
     TRI_ASSERT(!hasFeature<Type>());
     auto& slot = _features[featureId];
@@ -461,7 +461,7 @@ class ApplicationServerT : public ApplicationServer {
   bool hasFeature() const noexcept {
     static_assert(std::is_base_of_v<ApplicationFeature, Type>);
 
-    constexpr auto featureId = Features::template id<Type>();
+    auto featureId = Features::template id<Type>();
     return nullptr != _features[featureId];
   }
 
@@ -472,7 +472,7 @@ class ApplicationServerT : public ApplicationServer {
     static_assert(std::is_base_of_v<ApplicationFeature, Type>);
     static_assert(std::is_base_of_v<Type, Impl> ||
                   std::is_base_of_v<Impl, Type>);
-    constexpr auto featureId = Features::template id<Type>();
+    auto featureId = Features::template id<Type>();
 
     TRI_ASSERT(hasFeature<Type>());
     auto& feature = *_features[featureId];
diff --git a/lib/Basics/TypeList.h b/lib/Basics/TypeList.h
index bf792f18b8d..a6fa6b0ef2a 100644
--- a/lib/Basics/TypeList.h
+++ b/lib/Basics/TypeList.h
@@ -66,13 +66,13 @@ class TypeList {
   }
 
   template<typename U>
-  static consteval bool contains() noexcept {
+  static bool contains() noexcept {
     return kTypes.find(ctti<U>()) != kTypes.end();
   }
 
   template<typename U>
-  static consteval size_t id() noexcept {
-    static_assert(contains<U>(), "Type not found");
+  static size_t id() noexcept {
+    assert(contains<U>() && "Type not found");
     return kTypes.find(ctti<U>())->second;
   }
 
-- 
2.39.2

openSUSE Build Service is sponsored by