diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9c25455fe38..599f7cfd3f3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,6 +32,9 @@ jobs: - name: Ensure no tabs run: | (! git grep -I -l $'\t' -- . ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false)) + - name: Ensure canonical include + run: | + (! git grep -I -l $'#include "' -- ./c10 || (echo "The above files have include with quotes; please convert them to #include "; false)) - name: Ensure C++ source files are not executable run: | (! find . \( -path ./third_party -o -path ./.git -o -path ./torch/bin -o -path ./build \) -prune -o -type f -executable -regextype posix-egrep -not -regex '.+(\.(bash|sh|py|so)|git-pre-commit)$' -print | grep . || (echo 'The above files have executable permission; please remove their executable permission by using `chmod -x`'; false)) diff --git a/c10/core/DispatchKey.cpp b/c10/core/DispatchKey.cpp index a68d41d6038..29097e89ca9 100644 --- a/c10/core/DispatchKey.cpp +++ b/c10/core/DispatchKey.cpp @@ -1,4 +1,4 @@ -#include "c10/core/DispatchKey.h" +#include namespace c10 { diff --git a/c10/core/DispatchKey.h b/c10/core/DispatchKey.h index 75e3784c4fd..dc0e9912289 100644 --- a/c10/core/DispatchKey.h +++ b/c10/core/DispatchKey.h @@ -2,7 +2,7 @@ #include #include -#include "c10/macros/Macros.h" +#include namespace c10 { diff --git a/c10/core/Event.h b/c10/core/Event.h index 9b4d7ddf122..70d03f91bb5 100644 --- a/c10/core/Event.h +++ b/c10/core/Event.h @@ -1,7 +1,7 @@ #pragma once -#include "c10/core/impl/InlineEvent.h" -#include "c10/core/impl/VirtualGuardImpl.h" +#include +#include namespace c10 { diff --git a/c10/core/impl/InlineEvent.h b/c10/core/impl/InlineEvent.h index dfc86173c68..4127b69a78b 100644 --- a/c10/core/impl/InlineEvent.h +++ b/c10/core/impl/InlineEvent.h @@ -1,9 +1,9 @@ #pragma once -#include "c10/core/DeviceType.h" -#include "c10/core/Stream.h" -#include "c10/util/Exception.h" -#include "c10/core/impl/DeviceGuardImplInterface.h" +#include +#include +#include +#include namespace c10 { namespace impl { diff --git a/c10/macros/Export.h b/c10/macros/Export.h index 71826d5b96b..b6eee395760 100644 --- a/c10/macros/Export.h +++ b/c10/macros/Export.h @@ -41,7 +41,7 @@ // file. #ifndef C10_USING_CUSTOM_GENERATED_MACROS -#include "c10/macros/cmake_macros.h" +#include #endif // C10_USING_CUSTOM_GENERATED_MACROS #ifdef _WIN32 diff --git a/c10/macros/Macros.h b/c10/macros/Macros.h index afd619221ec..7474a5dbf7e 100644 --- a/c10/macros/Macros.h +++ b/c10/macros/Macros.h @@ -18,10 +18,10 @@ // file. #ifndef C10_USING_CUSTOM_GENERATED_MACROS -#include "c10/macros/cmake_macros.h" +#include #endif // C10_USING_CUSTOM_GENERATED_MACROS -#include "c10/macros/Export.h" +#include #if defined(__clang__) #define __ubsan_ignore_float_divide_by_zero__ __attribute__((no_sanitize("float-divide-by-zero"))) diff --git a/c10/test/core/impl/InlineDeviceGuard_test.cpp b/c10/test/core/impl/InlineDeviceGuard_test.cpp index 570404d29fd..278fb88f055 100644 --- a/c10/test/core/impl/InlineDeviceGuard_test.cpp +++ b/c10/test/core/impl/InlineDeviceGuard_test.cpp @@ -1,7 +1,7 @@ #include -#include "c10/core/impl/InlineDeviceGuard.h" -#include "c10/core/impl/FakeGuardImpl.h" +#include +#include using namespace c10; using namespace c10::impl; diff --git a/c10/test/util/typeid_test.cpp b/c10/test/util/typeid_test.cpp index 5d3ed552790..65e93c56916 100644 --- a/c10/test/util/typeid_test.cpp +++ b/c10/test/util/typeid_test.cpp @@ -1,4 +1,4 @@ -#include "c10/util/typeid.h" +#include #include using std::string; diff --git a/c10/util/Backtrace.cpp b/c10/util/Backtrace.cpp index 2865cc3ad51..094da9581d4 100644 --- a/c10/util/Backtrace.cpp +++ b/c10/util/Backtrace.cpp @@ -1,6 +1,6 @@ -#include "c10/util/Backtrace.h" -#include "c10/util/Optional.h" -#include "c10/util/Type.h" +#include +#include +#include #include #include diff --git a/c10/util/Backtrace.h b/c10/util/Backtrace.h index 21afac0eb6c..75691286d90 100644 --- a/c10/util/Backtrace.h +++ b/c10/util/Backtrace.h @@ -5,7 +5,7 @@ #include #include -#include "c10/macros/Macros.h" +#include namespace c10 { C10_API std::string get_backtrace( diff --git a/c10/util/Exception.cpp b/c10/util/Exception.cpp index b61194a2985..61401948fb3 100644 --- a/c10/util/Exception.cpp +++ b/c10/util/Exception.cpp @@ -1,7 +1,7 @@ -#include "c10/util/Exception.h" -#include "c10/util/Backtrace.h" -#include "c10/util/Type.h" -#include "c10/util/Logging.h" +#include +#include +#include +#include #include #include diff --git a/c10/util/Exception.h b/c10/util/Exception.h index 6f65a435e2b..82c40ae285c 100644 --- a/c10/util/Exception.h +++ b/c10/util/Exception.h @@ -1,9 +1,9 @@ #ifndef C10_UTIL_EXCEPTION_H_ #define C10_UTIL_EXCEPTION_H_ -#include "c10/macros/Macros.h" -#include "c10/util/StringUtil.h" -#include "c10/util/Deprecated.h" +#include +#include +#include #include #include diff --git a/c10/util/Flags.h b/c10/util/Flags.h index b26d4a724d9..6bfe62507fc 100644 --- a/c10/util/Flags.h +++ b/c10/util/Flags.h @@ -32,8 +32,8 @@ #include -#include "c10/macros/Macros.h" -#include "c10/util/Registry.h" +#include +#include namespace c10 { /** diff --git a/c10/util/Logging.cpp b/c10/util/Logging.cpp index ed9f35e0010..696c61131af 100644 --- a/c10/util/Logging.cpp +++ b/c10/util/Logging.cpp @@ -1,6 +1,6 @@ -#include "c10/util/Logging.h" -#include "c10/util/Backtrace.h" -#include "c10/util/Flags.h" +#include +#include +#include #include #include diff --git a/c10/util/Logging.h b/c10/util/Logging.h index be4fce123f4..88dc326d48d 100644 --- a/c10/util/Logging.h +++ b/c10/util/Logging.h @@ -7,10 +7,10 @@ #include #include -#include "c10/macros/Macros.h" -#include "c10/util/Exception.h" -#include "c10/util/Flags.h" -#include "c10/util/StringUtil.h" +#include +#include +#include +#include // CAFFE2_LOG_THRESHOLD is a compile time flag that would allow us to turn off // logging at compile time so no logging message below that level is produced @@ -23,9 +23,9 @@ // Below are different implementations for glog and non-glog cases. #ifdef C10_USE_GLOG -#include "c10/util/logging_is_google_glog.h" +#include #else // !C10_USE_GLOG -#include "c10/util/logging_is_not_google_glog.h" +#include #endif // C10_USE_GLOG C10_DECLARE_int(caffe2_log_level); diff --git a/c10/util/Optional.cpp b/c10/util/Optional.cpp index f1a639e9400..7389393e662 100644 --- a/c10/util/Optional.cpp +++ b/c10/util/Optional.cpp @@ -1 +1 @@ -#include "c10/util/Optional.h" +#include diff --git a/c10/util/Registry.h b/c10/util/Registry.h index b38e92eb4a4..b0135f2157c 100644 --- a/c10/util/Registry.h +++ b/c10/util/Registry.h @@ -19,8 +19,8 @@ #include #include -#include "c10/macros/Macros.h" -#include "c10/util/Type.h" +#include +#include namespace c10 { diff --git a/c10/util/StringUtil.cpp b/c10/util/StringUtil.cpp index 7c46b133207..673a6f68fc0 100644 --- a/c10/util/StringUtil.cpp +++ b/c10/util/StringUtil.cpp @@ -1,5 +1,5 @@ -#include "c10/util/StringUtil.h" -#include "c10/util/Exception.h" +#include +#include #include #include diff --git a/c10/util/Type.cpp b/c10/util/Type.cpp index 3e00055c699..d52e4d12591 100644 --- a/c10/util/Type.cpp +++ b/c10/util/Type.cpp @@ -1,4 +1,4 @@ -#include "c10/util/Type.h" +#include #include #include diff --git a/c10/util/Type.h b/c10/util/Type.h index 869269cb3f8..6d5e3c25887 100644 --- a/c10/util/Type.h +++ b/c10/util/Type.h @@ -5,7 +5,7 @@ #include #include -#include "c10/macros/Macros.h" +#include namespace c10 { diff --git a/c10/util/flags_use_gflags.cpp b/c10/util/flags_use_gflags.cpp index dc5369fb338..c63d6fd437f 100644 --- a/c10/util/flags_use_gflags.cpp +++ b/c10/util/flags_use_gflags.cpp @@ -1,8 +1,8 @@ -#include "c10/util/Flags.h" +#include #include -#include "c10/macros/Macros.h" +#include #ifdef C10_USE_GFLAGS diff --git a/c10/util/flags_use_no_gflags.cpp b/c10/util/flags_use_no_gflags.cpp index cedd4f41605..0ba8683abb4 100644 --- a/c10/util/flags_use_no_gflags.cpp +++ b/c10/util/flags_use_no_gflags.cpp @@ -1,5 +1,5 @@ -#include "c10/util/Flags.h" -#include "c10/macros/Macros.h" +#include +#include #include #include diff --git a/c10/util/logging_is_not_google_glog.h b/c10/util/logging_is_not_google_glog.h index f2c281f8cfb..5d46c15e8d4 100644 --- a/c10/util/logging_is_not_google_glog.h +++ b/c10/util/logging_is_not_google_glog.h @@ -12,7 +12,7 @@ #include #include -#include "c10/util/Flags.h" +#include // Log severity level constants. const int FATAL = 3; diff --git a/c10/util/numa.cpp b/c10/util/numa.cpp index 60186dc1550..b92ef71afdd 100644 --- a/c10/util/numa.cpp +++ b/c10/util/numa.cpp @@ -1,4 +1,4 @@ -#include "c10/util/numa.h" +#include C10_DEFINE_bool(caffe2_cpu_numa_enabled, false, "Use NUMA whenever possible."); diff --git a/c10/util/sparse_bitset.h b/c10/util/sparse_bitset.h index 5a4afbb8cf6..e8ef80e797e 100644 --- a/c10/util/sparse_bitset.h +++ b/c10/util/sparse_bitset.h @@ -17,7 +17,7 @@ #include #include #include - #include "./llvmMathExtras.h" + #include namespace c10 { diff --git a/c10/util/thread_name.cpp b/c10/util/thread_name.cpp index dfc7528dc2b..c503df11249 100644 --- a/c10/util/thread_name.cpp +++ b/c10/util/thread_name.cpp @@ -1,4 +1,4 @@ -#include "c10/util/thread_name.h" +#include #include diff --git a/c10/util/thread_name.h b/c10/util/thread_name.h index b7b0d342451..2420abf7ad0 100644 --- a/c10/util/thread_name.h +++ b/c10/util/thread_name.h @@ -2,7 +2,7 @@ #include -#include "c10/macros/Export.h" +#include namespace c10 {