mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Canonicalize includes in c10, and add tests for it (#36299)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/36299 Test Plan: Imported from OSS Differential Revision: D20943005 Pulled By: ezyang fbshipit-source-id: 9dd0a58824bd0f1b5ad259942f92954ba1f63eae
This commit is contained in:
committed by
Facebook GitHub Bot
parent
42457e634d
commit
15c7486416
3
.github/workflows/lint.yml
vendored
3
.github/workflows/lint.yml
vendored
@ -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 <xxxx>"; 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))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "c10/core/DispatchKey.h"
|
||||
#include <c10/core/DispatchKey.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "c10/macros/Macros.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "c10/core/impl/InlineEvent.h"
|
||||
#include "c10/core/impl/VirtualGuardImpl.h"
|
||||
#include <c10/core/impl/InlineEvent.h>
|
||||
#include <c10/core/impl/VirtualGuardImpl.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -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 <c10/core/DeviceType.h>
|
||||
#include <c10/core/Stream.h>
|
||||
#include <c10/util/Exception.h>
|
||||
#include <c10/core/impl/DeviceGuardImplInterface.h>
|
||||
|
||||
namespace c10 {
|
||||
namespace impl {
|
||||
|
@ -41,7 +41,7 @@
|
||||
// file.
|
||||
|
||||
#ifndef C10_USING_CUSTOM_GENERATED_MACROS
|
||||
#include "c10/macros/cmake_macros.h"
|
||||
#include <c10/macros/cmake_macros.h>
|
||||
#endif // C10_USING_CUSTOM_GENERATED_MACROS
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -18,10 +18,10 @@
|
||||
// file.
|
||||
|
||||
#ifndef C10_USING_CUSTOM_GENERATED_MACROS
|
||||
#include "c10/macros/cmake_macros.h"
|
||||
#include <c10/macros/cmake_macros.h>
|
||||
#endif // C10_USING_CUSTOM_GENERATED_MACROS
|
||||
|
||||
#include "c10/macros/Export.h"
|
||||
#include <c10/macros/Export.h>
|
||||
|
||||
#if defined(__clang__)
|
||||
#define __ubsan_ignore_float_divide_by_zero__ __attribute__((no_sanitize("float-divide-by-zero")))
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "c10/core/impl/InlineDeviceGuard.h"
|
||||
#include "c10/core/impl/FakeGuardImpl.h"
|
||||
#include <c10/core/impl/InlineDeviceGuard.h>
|
||||
#include <c10/core/impl/FakeGuardImpl.h>
|
||||
|
||||
using namespace c10;
|
||||
using namespace c10::impl;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "c10/util/typeid.h"
|
||||
#include <c10/util/typeid.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using std::string;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "c10/util/Backtrace.h"
|
||||
#include "c10/util/Optional.h"
|
||||
#include "c10/util/Type.h"
|
||||
#include <c10/util/Backtrace.h>
|
||||
#include <c10/util/Optional.h>
|
||||
#include <c10/util/Type.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
namespace c10 {
|
||||
C10_API std::string get_backtrace(
|
||||
|
@ -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 <c10/util/Exception.h>
|
||||
#include <c10/util/Backtrace.h>
|
||||
#include <c10/util/Type.h>
|
||||
#include <c10/util/Logging.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
|
@ -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 <c10/macros/Macros.h>
|
||||
#include <c10/util/StringUtil.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include "c10/util/Registry.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <c10/util/Registry.h>
|
||||
|
||||
namespace c10 {
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "c10/util/Logging.h"
|
||||
#include "c10/util/Backtrace.h"
|
||||
#include "c10/util/Flags.h"
|
||||
#include <c10/util/Logging.h>
|
||||
#include <c10/util/Backtrace.h>
|
||||
#include <c10/util/Flags.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
@ -7,10 +7,10 @@
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include "c10/util/Exception.h"
|
||||
#include "c10/util/Flags.h"
|
||||
#include "c10/util/StringUtil.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <c10/util/Exception.h>
|
||||
#include <c10/util/Flags.h>
|
||||
#include <c10/util/StringUtil.h>
|
||||
|
||||
// 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 <c10/util/logging_is_google_glog.h>
|
||||
#else // !C10_USE_GLOG
|
||||
#include "c10/util/logging_is_not_google_glog.h"
|
||||
#include <c10/util/logging_is_not_google_glog.h>
|
||||
#endif // C10_USE_GLOG
|
||||
|
||||
C10_DECLARE_int(caffe2_log_level);
|
||||
|
@ -1 +1 @@
|
||||
#include "c10/util/Optional.h"
|
||||
#include <c10/util/Optional.h>
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include "c10/util/Type.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <c10/util/Type.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "c10/util/StringUtil.h"
|
||||
#include "c10/util/Exception.h"
|
||||
#include <c10/util/StringUtil.h>
|
||||
#include <c10/util/Exception.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "c10/util/Type.h"
|
||||
#include <c10/util/Type.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "c10/util/Flags.h"
|
||||
#include <c10/util/Flags.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "c10/macros/Macros.h"
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
#ifdef C10_USE_GFLAGS
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "c10/util/Flags.h"
|
||||
#include "c10/macros/Macros.h"
|
||||
#include <c10/util/Flags.h>
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "c10/util/Flags.h"
|
||||
#include <c10/util/Flags.h>
|
||||
|
||||
// Log severity level constants.
|
||||
const int FATAL = 3;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "c10/util/numa.h"
|
||||
#include <c10/util/numa.h>
|
||||
|
||||
C10_DEFINE_bool(caffe2_cpu_numa_enabled, false, "Use NUMA whenever possible.");
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include "./llvmMathExtras.h"
|
||||
#include <c10/util/llvmMathExtras.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "c10/util/thread_name.h"
|
||||
#include <c10/util/thread_name.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "c10/macros/Export.h"
|
||||
#include <c10/macros/Export.h>
|
||||
|
||||
namespace c10 {
|
||||
|
||||
|
Reference in New Issue
Block a user