Do not include headers necessary for logging when logging is disabled

Speeds up compilation by 30% for some files when logging is disabled.

Signed-off-by: Matthew Bentham <Matthew.Bentham@arm.com>
Change-Id: Ia479bd50a80616a34e33ead13db8558f8dbaa1aa
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/534480
Tested-by: bsgcomp <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Comments-Addressed: bsgcomp <bsgcomp@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9880
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
diff --git a/src/c/AclContext.cpp b/src/c/AclContext.cpp
index dbf2a3d..9b8ffea 100644
--- a/src/c/AclContext.cpp
+++ b/src/c/AclContext.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021,2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -23,6 +23,8 @@
  */
 #include "arm_compute/AclEntrypoints.h"
 
+#include "arm_compute/core/Error.h"
+
 #include "src/common/IContext.h"
 #include "src/common/utils/Macros.h"
 #include "src/common/utils/Validate.h"
diff --git a/src/c/AclTensor.cpp b/src/c/AclTensor.cpp
index 8f6ce45..5b18469 100644
--- a/src/c/AclTensor.cpp
+++ b/src/c/AclTensor.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021,2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -23,6 +23,7 @@
  */
 #include "arm_compute/AclEntrypoints.h"
 #include "arm_compute/AclUtils.h"
+#include "arm_compute/core/Error.h"
 #include "src/common/ITensorV2.h"
 #include "src/common/utils/Macros.h"
 
diff --git a/src/common/IContext.h b/src/common/IContext.h
index 1ae46c5..65bb767 100644
--- a/src/common/IContext.h
+++ b/src/common/IContext.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021,2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -29,6 +29,7 @@
 #include "src/common/utils/Object.h"
 
 #include <atomic>
+#include <tuple>
 
 struct AclContext_
 {
diff --git a/src/common/utils/Log.h b/src/common/utils/Log.h
index f3ae38a..bbfe1ce 100644
--- a/src/common/utils/Log.h
+++ b/src/common/utils/Log.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021,2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -24,11 +24,22 @@
 #ifndef SRC_COMMON_LOG_H
 #define SRC_COMMON_LOG_H
 
+#ifndef ARM_COMPUTE_LOGGING_ENABLED
+
+#define ARM_COMPUTE_CREATE_ACL_LOGGER()
+#define ARM_COMPUTE_LOG_MSG_ACL(log_level, msg)
+#define ARM_COMPUTE_LOG_MSG_WITH_FORMAT_ACL(log_level, fmt, ...)
+#define ARM_COMPUTE_LOG_ERROR_ACL(msg)
+#define ARM_COMPUTE_LOG_ERROR_WITH_FUNCNAME_ACL(msg)
+#define ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL(msg)
+#define ARM_COMPUTE_LOG_PARAMS(...)
+
+#else /* ARM_COMPUTE_LOGGING_ENABLED */
+
 #include "arm_compute/core/Error.h"
 #include "arm_compute/core/utils/logging/Macros.h"
 #include "utils/TypePrinter.h"
 
-#ifdef ARM_COMPUTE_LOGGING_ENABLED
 /** Create a logger
  *
  * @note It will eventually create all default loggers in don't exist
@@ -41,9 +52,6 @@
             arm_compute::logging::LoggerRegistry::get().create_logger("ComputeLibrary", arm_compute::logging::LogLevel::INFO); \
         }                                                                                                                      \
     } while(false)
-#else /* ARM_COMPUTE_LOGGING_ENABLED */
-#define ARM_COMPUTE_CREATE_ACL_LOGGER()
-#endif /* ARM_COMPUTE_LOGGING_ENABLED */
 
 /** Log a message to the logger
  *
@@ -218,4 +226,5 @@
         ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL(constructDataLog(getParamsNames(#__VA_ARGS__), \
                                                                 logParams(__VA_ARGS__)));     \
     } while(false)
+#endif /* ARM_COMPUTE_LOGGING_ENABLED */
 #endif /* SRC_COMMON_LOG_H */
diff --git a/src/common/utils/Utils.h b/src/common/utils/Utils.h
index 79f4f39..1bd1c7e 100644
--- a/src/common/utils/Utils.h
+++ b/src/common/utils/Utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021,2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -24,6 +24,8 @@
 #ifndef SRC_COMMON_UTILS_H
 #define SRC_COMMON_UTILS_H
 
+#include <algorithm>
+#include <initializer_list>
 #include <type_traits>
 
 namespace arm_compute
@@ -72,7 +74,7 @@
 template <typename E>
 bool is_in(E check, std::initializer_list<E> list)
 {
-    return std::any_of(std::cbegin(list), std::cend(list), [&check](E e)
+    return std::any_of(list.begin(), list.end(), [&check](E e)
     {
         return check == e;
     });
diff --git a/src/cpu/CpuContext.cpp b/src/cpu/CpuContext.cpp
index d91f917..7c14891 100644
--- a/src/cpu/CpuContext.cpp
+++ b/src/cpu/CpuContext.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022 Arm Limited.
+ * Copyright (c) 2021-2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -37,6 +37,10 @@
 #endif // defined(_WIN64)
 #endif // !defined(__APPLE__) && !defined(__OpenBSD__)
 
+#ifndef BARE_METAL
+#include <thread>
+#endif /* BARE_METAL */
+
 namespace arm_compute
 {
 namespace cpu
diff --git a/src/cpu/operators/CpuMatMul.cpp b/src/cpu/operators/CpuMatMul.cpp
index 515b511..94013d7 100644
--- a/src/cpu/operators/CpuMatMul.cpp
+++ b/src/cpu/operators/CpuMatMul.cpp
@@ -23,6 +23,7 @@
  */
 
 #include "src/cpu/operators/CpuMatMul.h"
+#include "arm_compute/core/MatMulInfo.h"
 #include "arm_compute/core/Types.h"
 #include "arm_compute/core/Validate.h"
 #include "arm_compute/core/experimental/Types.h"
diff --git a/src/cpu/operators/CpuScale.cpp b/src/cpu/operators/CpuScale.cpp
index a13a0f5..8a712bf 100644
--- a/src/cpu/operators/CpuScale.cpp
+++ b/src/cpu/operators/CpuScale.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2022 Arm Limited.
+ * Copyright (c) 2021-2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -23,7 +23,9 @@
  */
 #include "src/cpu/operators/CpuScale.h"
 
+#include "arm_compute/core/Helpers.h"
 #include "arm_compute/runtime/NEON/NEScheduler.h"
+#include "arm_compute/core/TensorInfo.h"
 #include "src/common/utils/Log.h"
 #include "src/core/utils/ScaleUtils.h"
 #include "src/cpu/kernels/CpuScaleKernel.h"
diff --git a/src/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.cpp b/src/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.cpp
index 87439c4..95adfae 100644
--- a/src/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.cpp
+++ b/src/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.cpp
@@ -23,6 +23,7 @@
  */
 
 #include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.h"
+#include "arm_compute/core/ActivationLayerInfo.h"
 #include "arm_compute/core/experimental/Types.h"
 
 #include "src/common/utils/Log.h"
diff --git a/src/runtime/NEON/functions/NEAddMulAdd.cpp b/src/runtime/NEON/functions/NEAddMulAdd.cpp
index 55008de..cfeaefc 100644
--- a/src/runtime/NEON/functions/NEAddMulAdd.cpp
+++ b/src/runtime/NEON/functions/NEAddMulAdd.cpp
@@ -24,6 +24,7 @@
 
 #include "arm_compute/runtime/NEON/functions/NEAddMulAdd.h"
 
+#include "arm_compute/runtime/Tensor.h"
 #include "src/common/utils/Log.h"
 #include "src/core/helpers/MemoryHelpers.h"
 #include "src/cpu/operators/CpuAddMulAdd.h"
diff --git a/src/runtime/NEON/functions/NEScale.cpp b/src/runtime/NEON/functions/NEScale.cpp
index 686017f..09f0373 100644
--- a/src/runtime/NEON/functions/NEScale.cpp
+++ b/src/runtime/NEON/functions/NEScale.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2022 Arm Limited.
+ * Copyright (c) 2016-2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -23,6 +23,7 @@
  */
 #include "arm_compute/runtime/NEON/functions/NEScale.h"
 
+#include "arm_compute/runtime/Tensor.h"
 #include "src/common/utils/Log.h"
 #include "src/core/utils/ScaleUtils.h"
 #include "src/cpu/operators/CpuScale.h"