From 879599b65337d6e7ddb71795dd5d9aadc9677a12 Mon Sep 17 00:00:00 2001 From: Ehsan Saei <71217171+esigo@users.noreply.github.com> Date: Sat, 1 Jul 2023 12:47:13 +0200 Subject: [PATCH] Add Include what you use --- api/include/opentelemetry/version.h | 1 - ci/do_ci.sh | 12 ++++++++---- ci/setup_ci_environment.sh | 3 ++- sdk/include/opentelemetry/sdk/version/version.h | 2 -- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/api/include/opentelemetry/version.h b/api/include/opentelemetry/version.h index 2178591728..5fcde42541 100644 --- a/api/include/opentelemetry/version.h +++ b/api/include/opentelemetry/version.h @@ -4,7 +4,6 @@ #pragma once #include "opentelemetry/common/macros.h" -#include "opentelemetry/detail/preprocessor.h" #define OPENTELEMETRY_ABI_VERSION_NO 1 #define OPENTELEMETRY_VERSION "1.9.1" diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6020d22a04..8c4e811c0b 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -109,8 +109,9 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then -DWITH_ASYNC_EXPORT_PREVIEW=OFF \ -DOTELCPP_MAINTAINER_MODE=ON \ -DWITH_NO_DEPRECATED_CODE=ON \ + -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu" \ "${SRC_DIR}" - make -k + make -k CXX=include-what-you-use CXXFLAGS="-Xiwyu --error_always" make test exit 0 elif [[ "$1" == "cmake.maintainer.async.test" ]]; then @@ -132,8 +133,9 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DOTELCPP_MAINTAINER_MODE=ON \ -DWITH_NO_DEPRECATED_CODE=ON \ + -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu" \ "${SRC_DIR}" - make -k -j $(nproc) + make -k CXX=include-what-you-use CXXFLAGS="-Xiwyu --error_always" -j $(nproc) make test exit 0 elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then @@ -206,8 +208,9 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu" \ "${SRC_DIR}" - make -j $(nproc) + make -k CXX=include-what-you-use CXXFLAGS="-Xiwyu --error_always" -j $(nproc) make test exit 0 elif [[ "$1" == "cmake.c++20.stl.test" ]]; then @@ -219,8 +222,9 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DWITH_STL=ON \ + -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu" \ "${SRC_DIR}" - make -j $(nproc) + make -k CXX=include-what-you-use CXXFLAGS="-Xiwyu --error_always" -j $(nproc) make test exit 0 elif [[ "$1" == "cmake.legacy.test" ]]; then diff --git a/ci/setup_ci_environment.sh b/ci/setup_ci_environment.sh index f995ed75b5..8e93b8d5b5 100755 --- a/ci/setup_ci_environment.sh +++ b/ci/setup_ci_environment.sh @@ -11,4 +11,5 @@ apt-get install --no-install-recommends --no-install-suggests -y \ wget \ git \ valgrind \ - lcov + lcov \ + iwyu diff --git a/sdk/include/opentelemetry/sdk/version/version.h b/sdk/include/opentelemetry/sdk/version/version.h index 1c9c285f90..83cfce9cb3 100644 --- a/sdk/include/opentelemetry/sdk/version/version.h +++ b/sdk/include/opentelemetry/sdk/version/version.h @@ -3,8 +3,6 @@ #pragma once -#include "opentelemetry/detail/preprocessor.h" - #define OPENTELEMETRY_SDK_VERSION "1.9.1" #include "opentelemetry/version.h"