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
*/
#include <folly/experimental/RCUUtils.h>
-#include <folly/Portability.h>
#include <folly/ThreadLocal.h>
-
namespace folly {
namespace {
*/
#include <stdexcept>
-#include <typeinfo>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <folly/experimental/io/FsUtil.h>
#include <folly/Exception.h>
-#include <folly/portability/Unistd.h>
namespace bsys = ::boost::system;
* 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");
#include <folly/experimental/TestUtil.h>
-#include <sys/stat.h>
#include <sys/types.h>
#include <system_error>
#include <string>
#include <tuple>
-#include <stdexcept>
-
namespace folly {
void ManualExecutor::add(Func callback) {
#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;
#include <folly/futures/Timekeeper.h>
#include <folly/portability/GTest.h>
-#include <folly/portability/Unistd.h>
using namespace folly;
using std::chrono::milliseconds;
#include <folly/io/ShutdownSocketSet.h>
-#include <sys/types.h>
-
#include <chrono>
#include <thread>
#include <folly/io/async/DelayedDestructionBase.h>
#include <functional>
-#include <list>
-#include <vector>
#include <folly/portability/GTest.h>
#include <folly/io/async/test/Util.h>
#include <folly/portability/GTest.h>
-#include <vector>
-
using namespace folly;
using std::chrono::milliseconds;
#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;
#include <folly/portability/Unistd.h>
#include <errno.h>
-#include <sys/types.h>
#include <stdexcept>
namespace folly {
#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>
#include <folly/portability/GTest.h>
#include <thread>
-#include <semaphore.h>
using namespace folly;
using namespace folly::test;
#include <folly/ExceptionWrapper.h>
#include <folly/Conv.h>
-#include <folly/Portability.h>
#include <folly/portability/GTest.h>
using namespace folly;
#include <folly/Benchmark.h>
-#include <vector>
-
BENCHMARK(skip_overhead, iter) {
auto prev = FLAGS_minloglevel;
FLAGS_minloglevel = 2;
#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;
* limitations under the License.
*/
-#include <folly/Portability.h>
-
#include <memory>
#include <folly/portability/GTest.h>
#include <glog/logging.h>
-#include <algorithm>
#include <thread>
-#include <vector>
#include <random>
using namespace folly;
*/
#include <folly/ScopeGuard.h>
-#include <folly/Portability.h>
#include <glog/logging.h>
#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
#include <folly/Singleton.h>
#include <folly/SingletonVault_c.h>
-#include <thread>
-
#include <folly/portability/GTest.h>
FOLLY_TLS long instance_counter_instances = 0;
#include <boost/algorithm/string.hpp>
#include <folly/Benchmark.h>
#include <folly/Random.h>
-#include <cstdarg>
#include <random>
using namespace folly;
// worked as intended.
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <iostream>
-#include <thread>
#include <folly/ThreadLocal.h>