Commit d0856c87 authored by Mathieu Baudet's avatar Mathieu Baudet Committed by Facebook Github Bot

fbcode: remove unused includes from .cpp files with no #if and #define

Summary:
This is a first diff to remove the "easiest" unused includes in fbcode.

* For safety, we only touch .cpp files without #if and #define,
* We do not try to remove redundant systems headers (aka. "packing").

The diff was generated as follows:
```
foundation/scripts/ls-cpp-dirs | grep -v '^\(\.\.\|external/\|.*/external\)' | xargs ffmr -o /tmp/ffmr-diff-1 codegraph/scripts/ffmr/analyze_includes_no_headers_no_packing_skipping_ifdefs.sh

cat /tmp/ffmr-diff-1/*.diff | patch -p2
hg commit -m something
arc diff --prepare --nolint --nounit --less-context --excuse refactoring
```

Note: `grep -v` is just an optimization. The actual configuration is in these two files:
diffusion/FBS/browse/master/fbcode/codegraph/analysis/config.py
diffusion/FBS/browse/master/fbcode/codegraph/scripts/ffmr/analyze_includes_no_headers_no_packing_skipping_ifdefs.sh

See the task for more context, and the recent "safety" improvements on the tool.

depends on D4317825 for very few cases where `nolint` had to be manually added.

Reviewed By: igorsugak

Differential Revision: D4312617

fbshipit-source-id: ecc1f0addfd0651fa4770fcc43cd1314661a311a
parent 45d349f0
......@@ -15,10 +15,8 @@
*/
#include <folly/experimental/RCUUtils.h>
#include <folly/Portability.h>
#include <folly/ThreadLocal.h>
namespace folly {
namespace {
......
......@@ -15,7 +15,6 @@
*/
#include <stdexcept>
#include <typeinfo>
#include <thread>
#include <mutex>
#include <condition_variable>
......
......@@ -17,7 +17,6 @@
#include <folly/experimental/io/FsUtil.h>
#include <folly/Exception.h>
#include <folly/portability/Unistd.h>
namespace bsys = ::boost::system;
......
......@@ -14,25 +14,16 @@
* limitations under the License.
*/
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <iostream>
#include <stdexcept>
#include <system_error>
#include <folly/File.h>
#include <folly/Format.h>
#include <folly/MemoryMapping.h>
#include <folly/Portability.h>
#include <folly/Range.h>
#include <folly/ScopeGuard.h>
#include <folly/experimental/io/HugePages.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/Unistd.h>
DEFINE_bool(cp, false, "Copy file");
......
......@@ -16,7 +16,6 @@
#include <folly/experimental/TestUtil.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <system_error>
......
......@@ -20,8 +20,6 @@
#include <string>
#include <tuple>
#include <stdexcept>
namespace folly {
void ManualExecutor::add(Func callback) {
......
......@@ -16,13 +16,11 @@
#include <algorithm>
#include <atomic>
#include <exception>
#include <vector>
#include <folly/futures/Future.h>
#include <folly/portability/GTest.h>
using namespace std;
using namespace std::chrono;
using namespace folly;
......
......@@ -16,7 +16,6 @@
#include <folly/futures/Timekeeper.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Unistd.h>
using namespace folly;
using std::chrono::milliseconds;
......
......@@ -16,8 +16,6 @@
#include <folly/io/ShutdownSocketSet.h>
#include <sys/types.h>
#include <chrono>
#include <thread>
......
......@@ -34,8 +34,6 @@
#include <folly/io/async/DelayedDestructionBase.h>
#include <functional>
#include <list>
#include <vector>
#include <folly/portability/GTest.h>
......
......@@ -22,8 +22,6 @@
#include <folly/io/async/test/Util.h>
#include <folly/portability/GTest.h>
#include <vector>
using namespace folly;
using std::chrono::milliseconds;
......
......@@ -17,7 +17,6 @@
#include <folly/io/async/test/AsyncSSLSocketTest.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/ssl/SSLSession.h>
using namespace std;
......
......@@ -24,7 +24,6 @@
#include <folly/portability/Unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <stdexcept>
namespace folly {
......
......@@ -24,7 +24,6 @@
#include <folly/Assume.h>
#include <folly/Benchmark.h>
#include <folly/Conv.h>
#include <folly/portability/Atomic.h>
#include <folly/portability/GTest.h>
#include <folly/portability/SysTime.h>
......
......@@ -20,7 +20,6 @@
#include <folly/portability/GTest.h>
#include <thread>
#include <semaphore.h>
using namespace folly;
using namespace folly::test;
......
......@@ -18,7 +18,6 @@
#include <folly/ExceptionWrapper.h>
#include <folly/Conv.h>
#include <folly/Portability.h>
#include <folly/portability/GTest.h>
using namespace folly;
......
......@@ -18,8 +18,6 @@
#include <folly/Benchmark.h>
#include <vector>
BENCHMARK(skip_overhead, iter) {
auto prev = FLAGS_minloglevel;
FLAGS_minloglevel = 2;
......
......@@ -19,12 +19,9 @@
#include <folly/Baton.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Windows.h>
#include <memory>
#include <thread>
#include <assert.h>
#include <semaphore.h>
using namespace folly;
using namespace folly::detail;
......
......@@ -14,8 +14,6 @@
* limitations under the License.
*/
#include <folly/Portability.h>
#include <memory>
#include <folly/portability/GTest.h>
......
......@@ -22,9 +22,7 @@
#include <glog/logging.h>
#include <algorithm>
#include <thread>
#include <vector>
#include <random>
using namespace folly;
......
......@@ -15,7 +15,6 @@
*/
#include <folly/ScopeGuard.h>
#include <folly/Portability.h>
#include <glog/logging.h>
......
......@@ -22,8 +22,6 @@
#include <folly/test/SingletonTestStructs.h>
#include <folly/portability/GTest.h>
#include <glog/logging.h>
/*
* This test needs to be in its own file, as a standalone program.
* We want to ensure no other singletons are registered, so we can
......
......@@ -17,8 +17,6 @@
#include <folly/Singleton.h>
#include <folly/SingletonVault_c.h>
#include <thread>
#include <folly/portability/GTest.h>
FOLLY_TLS long instance_counter_instances = 0;
......
......@@ -19,7 +19,6 @@
#include <boost/algorithm/string.hpp>
#include <folly/Benchmark.h>
#include <folly/Random.h>
#include <cstdarg>
#include <random>
using namespace folly;
......
......@@ -23,7 +23,6 @@
// worked as intended.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
......
......@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <thread>
#include <folly/ThreadLocal.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment