Skip to content

Commit

Permalink
iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Nov 22, 2023
1 parent 68097f8 commit 03902d5
Show file tree
Hide file tree
Showing 176 changed files with 254 additions and 620 deletions.
6 changes: 3 additions & 3 deletions cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function(dsn_setup_system_libs)
endfunction(dsn_setup_system_libs)

function(dsn_setup_include_path)#TODO(huangwei5): remove this
include_directories(${THIRDPARTY_INSTALL_DIR}/include)
include_directories(SYSTEM ${THIRDPARTY_INSTALL_DIR}/include)
endfunction(dsn_setup_include_path)

function(dsn_setup_thirdparty_libs)
Expand All @@ -320,7 +320,7 @@ function(dsn_setup_thirdparty_libs)
set(CMAKE_PREFIX_PATH ${THIRDPARTY_INSTALL_DIR};${CMAKE_PREFIX_PATH})
message(STATUS "CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
find_package(Boost COMPONENTS system filesystem regex REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

find_library(THRIFT_LIB NAMES libthrift.a PATHS ${THIRDPARTY_INSTALL_DIR}/lib NO_DEFAULT_PATH)
if(NOT THRIFT_LIB)
Expand Down Expand Up @@ -349,7 +349,7 @@ function(dsn_setup_thirdparty_libs)
link_libraries(${JAVA_JVM_LIBRARY})

find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
link_libraries(${OPENSSL_CRYPTO_LIBRARY})
link_libraries(${OPENSSL_SSL_LIBRARY})

Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function run_build()
echo "Running cmake Pegasus..."
pushd $BUILD_DIR
if [ ! -z "${IWYU}" ]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=${IWYU}"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE='${IWYU};-Xiwyu;--mapping_file=${ROOT}/iwyu/gmock.imp;--mapping_file=${ROOT}/iwyu/gmock.imp'"
fi
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DBUILD_TEST=${BUILD_TEST}"
cmake ${ROOT} -DCMAKE_INSTALL_PREFIX=$BUILD_DIR/output $CMAKE_OPTIONS
Expand Down
5 changes: 5 additions & 0 deletions src/aio/disk_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
#include "utils/link.h"
#include "utils/threadpool_code.h"

namespace rocksdb {
class RandomAccessFile;
class RandomRWFile;
} // namespace rocksdb

namespace dsn {
DEFINE_TASK_CODE_AIO(LPC_AIO_BATCH_WRITE, TASK_PRIORITY_COMMON, THREAD_POOL_DEFAULT)

Expand Down
5 changes: 1 addition & 4 deletions src/aio/test/aio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
*/

#include <fmt/core.h>
// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <rocksdb/status.h>
#include <string.h>
#include <algorithm>
Expand All @@ -41,6 +37,7 @@

#include "aio/aio_task.h"
#include "aio/file_io.h"
#include "gtest/gtest.h"
#include "runtime/task/task_code.h"
#include "runtime/tool_api.h"
#include "test_util/test_util.h"
Expand Down
4 changes: 1 addition & 3 deletions src/base/test/redact_sensitive_string_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <string>

#include "base/pegasus_utils.h"
#include "gtest/gtest.h"

const std::string test_string = "pegasus";

Expand Down
4 changes: 1 addition & 3 deletions src/base/test/utils_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <list>
#include <string>

#include "../pegasus_utils.h"
#include "gtest/gtest.h"

namespace pegasus {
namespace utils {
Expand Down
4 changes: 1 addition & 3 deletions src/base/test/value_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <stdint.h>
#include <string>

#include "base/value_schema_manager.h"
#include "gtest/gtest.h"
#include "pegasus_value_schema.h"
#include "utils/string_view.h"
#include "value_field.h"
Expand Down
4 changes: 1 addition & 3 deletions src/base/test/value_schema_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <rocksdb/slice.h>
#include <stdint.h>
#include <array>
Expand All @@ -31,6 +28,7 @@

#include "base/pegasus_value_schema.h"
#include "base/value_schema_manager.h"
#include "gtest/gtest.h"
#include "utils/blob.h"
#include "utils/string_view.h"
#include "value_field.h"
Expand Down
6 changes: 2 additions & 4 deletions src/block_service/test/block_service_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
// specific language governing permissions and limitations
// under the License.

// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
// IWYU pragma: no_include <algorithm>
#include <cstdint>
#include <map>
#include <memory>
Expand All @@ -28,6 +25,7 @@
#include "block_service/block_service_manager.h"
#include "block_service/local/local_service.h"
#include "block_service_mock.h"
#include "gtest/gtest.h"
#include "metadata_types.h"
#include "test_util/test_util.h"
#include "utils/error_code.h"
Expand Down
4 changes: 1 addition & 3 deletions src/block_service/test/fds_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

#include <errno.h>
#include <fcntl.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
Expand All @@ -32,6 +29,7 @@
#include <memory>

#include "block_service/block_service.h"
#include "gtest/gtest.h"
#include "utils/autoref_ptr.h"
#include "utils/blob.h"
#include "utils/enum_helper.h"
Expand Down
7 changes: 1 addition & 6 deletions src/block_service/test/hdfs_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,20 @@
// under the License.

#include <fmt/core.h>
#include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <rocksdb/env.h>
#include <rocksdb/slice.h>
#include <rocksdb/status.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

#include "block_service/block_service.h"
#include "block_service/hdfs/hdfs_service.h"
#include "gtest/gtest.h"
#include "runtime/api_layer1.h"
#include "runtime/task/async_calls.h"
#include "runtime/task/task.h"
Expand Down
5 changes: 1 addition & 4 deletions src/block_service/test/local_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
*/

#include <boost/filesystem/operations.hpp>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <nlohmann/detail/json_ref.hpp>
#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
Expand All @@ -35,6 +31,7 @@
#include <vector>

#include "block_service/local/local_service.h"
#include "gtest/gtest.h"
#include "test_util/test_util.h"
#include "utils/env.h"
#include "utils/error_code.h"
Expand Down
5 changes: 1 addition & 4 deletions src/client/test/ddl_client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
// under the License.

#include <fmt/core.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <stdint.h>
#include <algorithm>
#include <deque>
#include <memory>
#include <vector>

#include "client/replication_ddl_client.h"
#include "common/replication.codes.h"
#include "gtest/gtest.h"
#include "meta_admin_types.h"
#include "runtime/api_layer1.h"
#include "runtime/rpc/rpc_address.h"
Expand Down
5 changes: 2 additions & 3 deletions src/common/test/common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@

#include "common/common.h"

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <memory>

#include "gtest/gtest.h"

namespace dsn {
TEST(duplication_common, get_current_cluster_name)
{
Expand Down
4 changes: 1 addition & 3 deletions src/common/test/duplication_common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@

#include "common//duplication_common.h"

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <cstdint>

#include "gtest/gtest.h"
#include "utils/error_code.h"

namespace dsn {
Expand Down
8 changes: 2 additions & 6 deletions src/common/test/fs_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <ext/alloc_traits.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <ext/alloc_traits.h>
#include <stdint.h>
#include <map>
#include <memory>
#include <ostream>
#include <set>
#include <string>
#include <vector>

#include "common/fs_manager.h"
#include "common/gpid.h"
#include "common/replication_other_types.h"
#include "gtest/gtest.h"
#include "metadata_types.h"
#include "test_util/test_util.h"
#include "utils/fail_point.h"
Expand Down
5 changes: 1 addition & 4 deletions src/common/test/replication_common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <stdint.h>
#include <algorithm>
#include <fstream>
#include <string>
#include <vector>

#include "common/replication_common.h"
#include "gtest/gtest.h"
#include "utils/filesystem.h"

namespace dsn {
Expand Down
7 changes: 3 additions & 4 deletions src/failure_detector/test/failure_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
* THE SOFTWARE.
*/

// IWYU pragma: no_include <ext/alloc_traits.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <ext/alloc_traits.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
Expand All @@ -39,12 +36,14 @@
#include <memory>
#include <string>
#include <thread>
#include <tuple>
#include <utility>
#include <vector>

#include "failure_detector/failure_detector.h"
#include "failure_detector/failure_detector_multimaster.h"
#include "fd_types.h"
#include "gtest/gtest.h"
#include "meta/meta_options.h"
#include "meta/meta_server_failure_detector.h"
#include "replica/replica_stub.h"
Expand Down
5 changes: 1 addition & 4 deletions src/geo/test/geo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
*/

#include <base/pegasus_key_schema.h>
// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <math.h>
#include <pegasus/error.h>
#include <s2/s1angle.h>
Expand All @@ -43,6 +39,7 @@
#include "client/replication_ddl_client.h"
#include "common/replication_other_types.h"
#include "geo/lib/geo_client.h"
#include "gtest/gtest.h"
#include "pegasus/client.h"
#include "runtime/rpc/rpc_address.h"
#include "utils/blob.h"
Expand Down
4 changes: 1 addition & 3 deletions src/geo/test/latlng_codec_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
* under the License.
*/

// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <s2/s1angle.h>
#include <s2/s2latlng.h>
#include <s2/third_party/absl/base/port.h>
#include <string>

#include "geo/lib/latlng_codec.h"
#include "gtest/gtest.h"
#include "utils/errors.h"

namespace pegasus {
Expand Down
3 changes: 2 additions & 1 deletion src/http/test/http_client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
// under the License.

#include <fmt/core.h>
#include <gtest/gtest.h>
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-param-test.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <cstring>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

#include "gtest/gtest.h"
#include "http/http_client.h"
#include "http/http_method.h"
#include "utils/error_code.h"
Expand Down
Loading

0 comments on commit 03902d5

Please sign in to comment.