kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [02/14] kudu git commit: [iwyu] first pass
Date Mon, 21 Aug 2017 21:03:49 GMT
http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/knapsack_solver-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/knapsack_solver-test.cc b/src/kudu/util/knapsack_solver-test.cc
index 00b04cd..9f717c4 100644
--- a/src/kudu/util/knapsack_solver-test.cc
+++ b/src/kudu/util/knapsack_solver-test.cc
@@ -15,13 +15,15 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/logging.h>
-#include <gtest/gtest.h>
+#include <cstdlib>
+#include <memory>
 #include <string>
 #include <vector>
 
+#include <gtest/gtest.h>
+
 #include "kudu/util/knapsack_solver.h"
-#include "kudu/util/stopwatch.h"
+#include "kudu/util/stopwatch.h"  // IWYU pragma: keep
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/locks.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/locks.cc b/src/kudu/util/locks.cc
index 2fe9661..380bee4 100644
--- a/src/kudu/util/locks.cc
+++ b/src/kudu/util/locks.cc
@@ -17,6 +17,7 @@
 
 #include "kudu/util/locks.h"
 
+#include "kudu/gutil/atomicops.h"
 #include "kudu/util/malloc.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/locks.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/locks.h b/src/kudu/util/locks.h
index f4ab4a7..51467b9 100644
--- a/src/kudu/util/locks.h
+++ b/src/kudu/util/locks.h
@@ -17,11 +17,14 @@
 #ifndef KUDU_UTIL_LOCKS_H
 #define KUDU_UTIL_LOCKS_H
 
-#include <algorithm>
-#include <glog/logging.h>
+#include <sched.h>
+
+#include <algorithm>  // IWYU pragma: keep
+#include <cstddef>
 #include <mutex>
 
-#include "kudu/gutil/atomicops.h"
+#include <glog/logging.h>
+
 #include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/logging-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/logging-test.cc b/src/kudu/util/logging-test.cc
index e3a0771..d9ba2ca 100644
--- a/src/kudu/util/logging-test.cc
+++ b/src/kudu/util/logging-test.cc
@@ -16,20 +16,24 @@
 // under the License.
 
 #include <atomic>
-#include <glog/logging.h>
-#include <gmock/gmock.h>
+#include <ctime>
+#include <ostream>
 #include <string>
 #include <thread>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gmock/gmock-matchers.h>
+#include <gtest/gtest.h>
+
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/async_logger.h"
 #include "kudu/util/barrier.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/logging.h"
 #include "kudu/util/logging_test_util.h"
 #include "kudu/util/monotime.h"
-#include "kudu/util/stopwatch.h"
+#include "kudu/util/test_macros.h"  // IWYU pragma: keep
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/logging.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/logging.cc b/src/kudu/util/logging.cc
index c62bfe7..64ada87 100644
--- a/src/kudu/util/logging.cc
+++ b/src/kudu/util/logging.cc
@@ -16,34 +16,36 @@
 // under the License.
 #include "kudu/util/logging.h"
 
-#include <stdio.h>
+#include <unistd.h>
 
 #include <algorithm>
+#include <cstdio>
+#include <cstdlib>
 #include <fstream>
-#include <iostream>
 #include <mutex>
-#include <sstream>
-#include <utility>
-#include <vector>
+#include <type_traits> // IWYU pragma: keep
 
-#include <boost/uuid/uuid.hpp>
-#include <boost/uuid/uuid_generators.hpp>
+#include <boost/uuid/random_generator.hpp>
 #include <boost/uuid/uuid_io.hpp>
+#include <gflags/gflags.h>
 #include <glog/logging.h>
 
-#include "kudu/gutil/callback.h"
+#include "kudu/gutil/callback.h"  // IWYU pragma: keep
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/spinlock.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/async_logger.h"
 #include "kudu/util/debug-util.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
-#include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
 #include "kudu/util/flag_tags.h"
+#include "kudu/util/logging_callback.h"
 #include "kudu/util/minidump.h"
 #include "kudu/util/signal.h"
 #include "kudu/util/status.h"
 
+struct tm;
+
 DEFINE_string(log_filename, "",
     "Prefix of log filename - "
     "full path is <log_dir>/<log_filename>.[INFO|WARN|ERROR|FATAL]");

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/logging.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/logging.h b/src/kudu/util/logging.h
index 682431e..bbef2d8 100644
--- a/src/kudu/util/logging.h
+++ b/src/kudu/util/logging.h
@@ -17,15 +17,16 @@
 #ifndef KUDU_UTIL_LOGGING_H
 #define KUDU_UTIL_LOGGING_H
 
+#include <cstdint>
+#include <iosfwd>
 #include <string>
-#include <gflags/gflags_declare.h>
+
 #include <glog/logging.h>
 
 #include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/walltime.h"
-#include "kudu/util/flags.h"
 #include "kudu/util/logging_callback.h"
 #include "kudu/util/status.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/maintenance_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager-test.cc b/src/kudu/util/maintenance_manager-test.cc
index 9e9654e..7cc6398 100644
--- a/src/kudu/util/maintenance_manager-test.cc
+++ b/src/kudu/util/maintenance_manager-test.cc
@@ -16,17 +16,27 @@
 // under the License.
 
 #include <atomic>
+#include <cstdint>
 #include <memory>
 #include <mutex>
+#include <ostream>
+#include <string>
 #include <vector>
 
-#include <gflags/gflags.h>
+#include <boost/bind.hpp> // IWYU pragma: keep
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/maintenance_manager.h"
-#include "kudu/util/mem_tracker.h"
+#include "kudu/util/maintenance_manager.pb.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/mutex.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/thread.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/maintenance_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager.cc b/src/kudu/util/maintenance_manager.cc
index dbe865f..3f27806 100644
--- a/src/kudu/util/maintenance_manager.cc
+++ b/src/kudu/util/maintenance_manager.cc
@@ -17,13 +17,18 @@
 
 #include "kudu/util/maintenance_manager.h"
 
-#include <gflags/gflags.h>
+#include <cstddef>
+#include <cstdint>
 #include <memory>
-#include <stdint.h>
+#include <mutex>
+#include <sstream>
 #include <string>
-#include <thread>
 #include <utility>
 
+#include <boost/bind.hpp>
+#include <gflags/gflags.h>
+
+#include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -31,12 +36,15 @@
 #include "kudu/util/debug/trace_logging.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/logging.h"
+#include "kudu/util/maintenance_manager.pb.h"
+#include "kudu/util/make_shared.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/process_memory.h"
 #include "kudu/util/random_util.h"
 #include "kudu/util/scoped_cleanup.h"
 #include "kudu/util/stopwatch.h"
 #include "kudu/util/thread.h"
+#include "kudu/util/threadpool.h"
 #include "kudu/util/trace.h"
 
 using std::pair;
@@ -114,6 +122,18 @@ void MaintenanceOp::Unregister() {
   manager_->UnregisterOp(this);
 }
 
+MaintenanceManagerStatusPB_OpInstancePB OpInstance::DumpToPB() const {
+  MaintenanceManagerStatusPB_OpInstancePB pb;
+  pb.set_thread_id(thread_id);
+  pb.set_name(name);
+  if (duration.Initialized()) {
+    pb.set_duration_millis(duration.ToMilliseconds());
+  }
+  MonoDelta delta(MonoTime::Now() - start_mono_time);
+  pb.set_millis_since_start(delta.ToMilliseconds());
+  return pb;
+}
+
 const MaintenanceManager::Options MaintenanceManager::kDefaultOptions = {
   .num_threads = 0,
   .polling_interval_ms = 0,

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/maintenance_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager.h b/src/kudu/util/maintenance_manager.h
index e939583..cfbc287 100644
--- a/src/kudu/util/maintenance_manager.h
+++ b/src/kudu/util/maintenance_manager.h
@@ -17,26 +17,29 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
+#include <algorithm>
 #include <functional>
 #include <map>
 #include <memory>
-#include <set>
+#include <mutex>
 #include <string>
-#include <thread>
+#include <unordered_map>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest_prod.h>
+
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/atomic.h"
 #include "kudu/util/condition_variable.h"
-#include "kudu/util/countdown_latch.h"
-#include "kudu/util/maintenance_manager.pb.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/mutex.h"
 #include "kudu/util/random.h"
-#include "kudu/util/thread.h"
-#include "kudu/util/threadpool.h"
+#include "kudu/util/status.h"
 
 namespace kudu {
 
@@ -44,6 +47,10 @@ template<class T>
 class AtomicGauge;
 class Histogram;
 class MaintenanceManager;
+class MaintenanceManagerStatusPB;
+class MaintenanceManagerStatusPB_OpInstancePB;
+class Thread;
+class ThreadPool;
 
 class MaintenanceOpStats {
  public:
@@ -156,17 +163,7 @@ struct OpInstance {
   MonoDelta duration;
   MonoTime start_mono_time;
 
-  MaintenanceManagerStatusPB_OpInstancePB DumpToPB() const {
-    MaintenanceManagerStatusPB_OpInstancePB pb;
-    pb.set_thread_id(thread_id);
-    pb.set_name(name);
-    if (duration.Initialized()) {
-      pb.set_duration_millis(duration.ToMilliseconds());
-    }
-    MonoDelta delta(MonoTime::Now() - start_mono_time);
-    pb.set_millis_since_start(delta.ToMilliseconds());
-    return pb;
-  }
+  MaintenanceManagerStatusPB_OpInstancePB DumpToPB() const;
 };
 
 // MaintenanceOp objects represent background operations that the

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/make_shared.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/make_shared.h b/src/kudu/util/make_shared.h
index af254df..c534ebf 100644
--- a/src/kudu/util/make_shared.h
+++ b/src/kudu/util/make_shared.h
@@ -18,6 +18,10 @@
 #ifndef KUDU_UTIL_MAKE_SHARED_H_
 #define KUDU_UTIL_MAKE_SHARED_H_
 
+#ifdef __GLIBCXX__
+#include <ext/alloc_traits.h>  // IWYU pragma: export
+#endif
+
 #include <memory>
 
 // It isn't possible to use std::make_shared() with a class that has private

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/map-util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/map-util-test.cc b/src/kudu/util/map-util-test.cc
index eb456d3..afbee94 100644
--- a/src/kudu/util/map-util-test.cc
+++ b/src/kudu/util/map-util-test.cc
@@ -19,9 +19,12 @@
 // part of util.
 #include "kudu/gutil/map-util.h"
 
-#include <gtest/gtest.h>
 #include <map>
 #include <memory>
+#include <string>
+#include <utility>
+
+#include <gtest/gtest.h>
 
 using std::map;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mem_tracker-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mem_tracker-test.cc b/src/kudu/util/mem_tracker-test.cc
index 075931a..dbadd09 100644
--- a/src/kudu/util/mem_tracker-test.cc
+++ b/src/kudu/util/mem_tracker-test.cc
@@ -18,13 +18,20 @@
 #include "kudu/util/mem_tracker.h"
 
 #include <atomic>
+#include <functional>
+#include <memory>
 #include <string>
+#include <system_error>
 #include <thread>
 #include <unordered_map>
 #include <utility>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/test_util.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mem_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mem_tracker.cc b/src/kudu/util/mem_tracker.cc
index 88e1d23..a074354 100644
--- a/src/kudu/util/mem_tracker.cc
+++ b/src/kudu/util/mem_tracker.cc
@@ -18,18 +18,20 @@
 #include "kudu/util/mem_tracker.h"
 
 #include <algorithm>
+#include <cstddef>
 #include <deque>
 #include <limits>
 #include <list>
 #include <memory>
-#include <mutex>
+#include <ostream>
+
+#include <gperftools/malloc_extension.h>  // IWYU pragma: keep
 
-#include "kudu/gutil/map-util.h"
 #include "kudu/gutil/once.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/mutex.h"
 #include "kudu/util/process_memory.h"
-#include "kudu/util/status.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mem_tracker.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/mem_tracker.h b/src/kudu/util/mem_tracker.h
index a43e9a2..0a5af4f 100644
--- a/src/kudu/util/mem_tracker.h
+++ b/src/kudu/util/mem_tracker.h
@@ -17,22 +17,20 @@
 #ifndef KUDU_UTIL_MEM_TRACKER_H
 #define KUDU_UTIL_MEM_TRACKER_H
 
+#include <algorithm>
+#include <cstdint>
 #include <list>
 #include <memory>
-#include <stdint.h>
 #include <string>
 #include <vector>
 
-#include "kudu/gutil/ref_counted.h"
+#include <glog/logging.h>
+
 #include "kudu/util/high_water_mark.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/mutex.h"
 
 namespace kudu {
 
-class Status;
-class MemTracker;
-
 // A MemTracker tracks memory consumption; it contains an optional limit and is
 // arranged into a tree structure such that the consumption tracked by a
 // MemTracker is also tracked by its ancestors.

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memcmpable_varint-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memcmpable_varint-test.cc b/src/kudu/util/memcmpable_varint-test.cc
index 8342937..fcbe25d 100644
--- a/src/kudu/util/memcmpable_varint-test.cc
+++ b/src/kudu/util/memcmpable_varint-test.cc
@@ -15,13 +15,20 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/logging.h>
+#include <cstdint>
+#include <ostream>
+#include <string>
+#include <utility>
+#include <vector>
+
 #include <gtest/gtest.h>
 
+#include "kudu/util/faststring.h"
 #include "kudu/util/hexdump.h"
 #include "kudu/util/memcmpable_varint.h"
 #include "kudu/util/random.h"
-#include "kudu/util/stopwatch.h"
+#include "kudu/util/slice.h"
+#include "kudu/util/stopwatch.h"  // IWYU pragma: keep
 #include "kudu/util/test_util.h"
 
 // Add operator<< to print pairs, used in a test below.

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memcmpable_varint.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memcmpable_varint.cc b/src/kudu/util/memcmpable_varint.cc
index 35314f8..b30eff6 100644
--- a/src/kudu/util/memcmpable_varint.cc
+++ b/src/kudu/util/memcmpable_varint.cc
@@ -94,11 +94,11 @@
 //      7      2**48-1      14.4
 //      8      2**56-1      16.8
 //      9      2**64-1      19.2
-//
+
+#include <cstddef>
 
 #include <glog/logging.h>
 
-#include "kudu/gutil/endian.h"
 #include "kudu/util/faststring.h"
 #include "kudu/util/memcmpable_varint.h"
 #include "kudu/util/slice.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memcmpable_varint.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memcmpable_varint.h b/src/kudu/util/memcmpable_varint.h
index c1ce071..955f89d 100644
--- a/src/kudu/util/memcmpable_varint.h
+++ b/src/kudu/util/memcmpable_varint.h
@@ -27,11 +27,13 @@
 #ifndef KUDU_UTIL_MEMCMPABLE_VARINT_H
 #define KUDU_UTIL_MEMCMPABLE_VARINT_H
 
-#include "kudu/util/faststring.h"
-#include "kudu/util/slice.h"
+#include <cstdint>
 
 namespace kudu {
 
+class Slice;
+class faststring;
+
 void PutMemcmpableVarint64(faststring *dst, uint64_t value);
 
 // Standard Get... routines parse a value from the beginning of a Slice

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/arena-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena-test.cc b/src/kudu/util/memory/arena-test.cc
index e476560..f4691c4 100644
--- a/src/kudu/util/memory/arena-test.cc
+++ b/src/kudu/util/memory/arena-test.cc
@@ -15,13 +15,17 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gflags/gflags.h>
-#include <glog/logging.h>
-#include <gtest/gtest.h>
+#include <cstdint>
+#include <cstring>
 #include <memory>
+#include <string>
 #include <thread>
 #include <vector>
 
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/util/memory/arena.h"
 #include "kudu/util/memory/memory.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/arena.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena.cc b/src/kudu/util/memory/arena.cc
index 427072f..6f65df4 100644
--- a/src/kudu/util/memory/arena.cc
+++ b/src/kudu/util/memory/arena.cc
@@ -20,17 +20,10 @@
 #include "kudu/util/memory/arena.h"
 
 #include <algorithm>
+#include <memory>
 #include <mutex>
 
-#include "kudu/util/debug-util.h"
-#include "kudu/util/flag_tags.h"
-
-using std::copy;
-using std::max;
 using std::min;
-using std::reverse;
-using std::sort;
-using std::swap;
 using std::unique_ptr;
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/arena.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena.h b/src/kudu/util/memory/arena.h
index 1db5585..750e9d9 100644
--- a/src/kudu/util/memory/arena.h
+++ b/src/kudu/util/memory/arena.h
@@ -23,19 +23,24 @@
 #ifndef KUDU_UTIL_MEMORY_ARENA_H_
 #define KUDU_UTIL_MEMORY_ARENA_H_
 
-#include <boost/signals2/dummy_mutex.hpp>
-#include <glog/logging.h>
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
 #include <memory>
-#include <mutex>
 #include <new>
-#include <stddef.h>
-#include <string.h>
+#include <ostream>
 #include <vector>
 
+#include <boost/signals2/dummy_mutex.hpp>
+#include <glog/logging.h>
+
+#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/gscoped_ptr.h"
-#include "kudu/gutil/logging-inl.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/strings/stringpiece.h"
 #include "kudu/util/alignment.h"
 #include "kudu/util/locks.h"
 #include "kudu/util/memory/memory.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/memory.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/memory.cc b/src/kudu/util/memory/memory.cc
index e393540..b3964df 100644
--- a/src/kudu/util/memory/memory.cc
+++ b/src/kudu/util/memory/memory.cc
@@ -20,10 +20,11 @@
 
 #include "kudu/util/memory/memory.h"
 
-#include <string.h>
+#include <mm_malloc.h>
 
 #include <algorithm>
 #include <cstdlib>
+#include <cstring>
 
 #include <gflags/gflags.h>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/memory.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/memory.h b/src/kudu/util/memory/memory.h
index ffe0a7c..972589e 100644
--- a/src/kudu/util/memory/memory.h
+++ b/src/kudu/util/memory/memory.h
@@ -33,18 +33,22 @@
 #define KUDU_UTIL_MEMORY_MEMORY_H_
 
 #include <algorithm>
-#include <glog/logging.h>
+#include <cstddef>
+#include <cstdint>
 #include <limits>
 #include <memory>
-#include <stddef.h>
+#include <ostream>
 #include <vector>
 
+#include <glog/logging.h>
+
 #include "kudu/util/boost_mutex_utils.h"
 #include "kudu/util/memory/overwrite.h"
 #include "kudu/util/mutex.h"
 #include "kudu/gutil/gscoped_ptr.h"
-#include "kudu/gutil/logging-inl.h"
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/singleton.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/memory/overwrite.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/overwrite.h b/src/kudu/util/memory/overwrite.h
index 04286ed..37c6512 100644
--- a/src/kudu/util/memory/overwrite.h
+++ b/src/kudu/util/memory/overwrite.h
@@ -17,6 +17,8 @@
 #ifndef KUDU_MEMORY_OVERWRITE_H
 #define KUDU_MEMORY_OVERWRITE_H
 
+#include <cstddef>
+
 #include "kudu/gutil/strings/stringpiece.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/metrics-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/metrics-test.cc b/src/kudu/util/metrics-test.cc
index 7493056..698fd7d 100644
--- a/src/kudu/util/metrics-test.cc
+++ b/src/kudu/util/metrics-test.cc
@@ -15,18 +15,28 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gtest/gtest.h>
-#include <rapidjson/document.h>
+#include <cstdint>
+#include <ostream>
 #include <string>
 #include <unordered_set>
 #include <vector>
 
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+#include <rapidjson/document.h>
+
 #include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/hdr_histogram.h"
 #include "kudu/util/jsonreader.h"
 #include "kudu/util/jsonwriter.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/metrics.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/metrics.cc b/src/kudu/util/metrics.cc
index df226d4..a0d39ba 100644
--- a/src/kudu/util/metrics.cc
+++ b/src/kudu/util/metrics.cc
@@ -16,24 +16,21 @@
 // under the License.
 #include "kudu/util/metrics.h"
 
+#include <algorithm>
+#include <cstdlib>
 #include <iostream>
-#include <sstream>
 #include <map>
-#include <set>
+#include <utility>
 
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 
-#include "kudu/gutil/atomicops.h"
-#include "kudu/gutil/casts.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/singleton.h"
-#include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/hdr_histogram.h"
 #include "kudu/util/histogram.pb.h"
-#include "kudu/util/jsonwriter.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/status.h"
 
 DEFINE_int32(metrics_retirement_age_ms, 120 * 1000,

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/metrics.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/metrics.h b/src/kudu/util/metrics.h
index b9b8509..f59a32c 100644
--- a/src/kudu/util/metrics.h
+++ b/src/kudu/util/metrics.h
@@ -223,7 +223,8 @@
 //
 /////////////////////////////////////////////////////
 
-#include <algorithm>
+#include <cstddef>
+#include <cstdint>
 #include <mutex>
 #include <string>
 #include <unordered_map>
@@ -234,11 +235,14 @@
 #include "kudu/gutil/bind.h"
 #include "kudu/gutil/callback.h"
 #include "kudu/gutil/casts.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
-#include "kudu/gutil/singleton.h"
 #include "kudu/util/atomic.h"
-#include "kudu/util/jsonwriter.h"
+#include "kudu/util/hdr_histogram.h"
+#include "kudu/util/jsonwriter.h" // IWYU pragma: keep
 #include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
@@ -317,6 +321,8 @@
 #define METRIC_DECLARE_gauge_size METRIC_DECLARE_gauge_uint64
 #endif
 
+template <typename Type> class Singleton;
+
 namespace kudu {
 
 class Counter;
@@ -324,9 +330,10 @@ class CounterPrototype;
 
 template<typename T>
 class AtomicGauge;
+template <typename Sig>
+class Callback;
 template<typename T>
 class FunctionGauge;
-class Gauge;
 template<typename T>
 class GaugePrototype;
 
@@ -335,7 +342,6 @@ class MetricEntityPrototype;
 class MetricPrototype;
 class MetricRegistry;
 
-class HdrHistogram;
 class Histogram;
 class HistogramPrototype;
 class HistogramSnapshotPB;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/minidump-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/minidump-test.cc b/src/kudu/util/minidump-test.cc
index f4c44e2..5c756b6 100644
--- a/src/kudu/util/minidump-test.cc
+++ b/src/kudu/util/minidump-test.cc
@@ -15,19 +15,24 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <signal.h>
-#include <sys/types.h>
 #include <unistd.h>
 
+#include <csignal>
+#include <cstdlib>
+#include <cstring>
+#include <ostream>
 #include <string>
 #include <vector>
 
-#include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
+#include <gtest/gtest.h>
 
-#include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/minidump.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/test_macros.h"
+#include "kudu/util/env.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/minidump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/minidump.cc b/src/kudu/util/minidump.cc
index c088ae7..d02dc5d 100644
--- a/src/kudu/util/minidump.cc
+++ b/src/kudu/util/minidump.cc
@@ -17,12 +17,14 @@
 
 #include "kudu/util/minidump.h"
 
-#include <signal.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include <atomic>
+#include <csignal>
+#include <cstdint>
+#include <cstdlib>
 #include <memory>
+#include <ostream>
 #include <string>
 
 #if defined(__linux__)
@@ -31,17 +33,19 @@
 #endif // defined(__linux__)
 
 #include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
 #include <glog/logging.h>
 
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/linux_syscall_support.h"
 #include "kudu/gutil/strings/human_readable.h"
 #include "kudu/util/errno.h"
 #include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
 #include "kudu/util/flag_tags.h"
-#include "kudu/util/logging.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/status.h"
+#include "kudu/util/thread.h"
 
 using kudu::env_util::CreateDirIfMissing;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/minidump.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/minidump.h b/src/kudu/util/minidump.h
index 459639b..893440a 100644
--- a/src/kudu/util/minidump.h
+++ b/src/kudu/util/minidump.h
@@ -22,8 +22,6 @@
 #include <string>
 
 #include "kudu/gutil/ref_counted.h"
-#include "kudu/util/locks.h"
-#include "kudu/util/thread.h"
 
 namespace google_breakpad {
 class ExceptionHandler;
@@ -33,6 +31,7 @@ namespace kudu {
 
 class Env;
 class Status;
+class Thread;
 
 // While an instance of this class is in scope, a Breakpad minidump handler
 // will generate a minidump for the current program if it crashes or if it

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/monotime-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/monotime-test.cc b/src/kudu/util/monotime-test.cc
index f193ecd..755dac5 100644
--- a/src/kudu/util/monotime-test.cc
+++ b/src/kudu/util/monotime-test.cc
@@ -20,6 +20,11 @@
 #include <sys/time.h>
 #include <unistd.h>
 
+#include <cstdint>
+#include <ctime>
+#include <ostream>
+#include <string>
+
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/monotime.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/monotime.cc b/src/kudu/util/monotime.cc
index b67be42..abe3664 100644
--- a/src/kudu/util/monotime.cc
+++ b/src/kudu/util/monotime.cc
@@ -17,17 +17,21 @@
 
 #include "kudu/util/monotime.h"
 
-#include <glog/logging.h>
-#include <limits>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/time.h>
-#include <time.h>
 
+#include <ctime>
+#include <limits>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/integral_types.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/sysinfo.h"
-#include "kudu/gutil/walltime.h"
 #include "kudu/util/thread_restrictions.h"
+#if defined(__APPLE__)
+#include "kudu/gutil/walltime.h"
+#endif
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/monotime.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/monotime.h b/src/kudu/util/monotime.h
index f261a99..59d92f0 100644
--- a/src/kudu/util/monotime.h
+++ b/src/kudu/util/monotime.h
@@ -17,7 +17,10 @@
 #ifndef KUDU_UTIL_MONOTIME_H
 #define KUDU_UTIL_MONOTIME_H
 
+// NOTE: using stdint.h instead of cstdint because this file is supposed
+//       to be processed by a compiler lacking C++11 support.
 #include <stdint.h>
+
 #include <string>
 
 #ifdef KUDU_HEADERS_NO_STUBS
@@ -32,11 +35,9 @@
 
 #include "kudu/util/kudu_export.h"
 
-struct timeval;
-struct timespec;
+struct timeval;   // IWYU pragma: keep
 
 namespace kudu {
-class MonoTime;
 
 /// @brief A representation of a time interval.
 ///

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mt-hdr_histogram-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mt-hdr_histogram-test.cc b/src/kudu/util/mt-hdr_histogram-test.cc
index 879c5e3..7221644 100644
--- a/src/kudu/util/mt-hdr_histogram-test.cc
+++ b/src/kudu/util/mt-hdr_histogram-test.cc
@@ -14,14 +14,19 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#include <gtest/gtest.h>
-#include <gflags/gflags.h>
+
+#include <cstdint>
 #include <vector>
 
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/hdr_histogram.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/thread.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mt-metrics-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mt-metrics-test.cc b/src/kudu/util/mt-metrics-test.cc
index c333215..2480d57 100644
--- a/src/kudu/util/mt-metrics-test.cc
+++ b/src/kudu/util/mt-metrics-test.cc
@@ -15,20 +15,26 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstdint>
+#include <cstring>
+#include <memory>
+#include <string>
 #include <vector>
 
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <boost/bind.hpp> // IWYU pragma: keep
+#include <boost/function.hpp> // IWYU pragma: keep
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/ref_counted.h"
+#include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
-#include "kudu/util/jsonwriter.h"
+#include "kudu/util/env.h"
 #include "kudu/util/metrics.h"
-#include "kudu/util/monotime.h"
+#include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/thread.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mt-threadlocal-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mt-threadlocal-test.cc b/src/kudu/util/mt-threadlocal-test.cc
index 2390b82..c0609d2 100644
--- a/src/kudu/util/mt-threadlocal-test.cc
+++ b/src/kudu/util/mt-threadlocal-test.cc
@@ -15,11 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/logging.h>
+#include <cstdint>
 #include <mutex>
+#include <ostream>
 #include <string>
+#include <vector>
 #include <unordered_set>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/ref_counted.h"
@@ -28,6 +33,10 @@
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/env.h"
 #include "kudu/util/locks.h"
+#include "kudu/util/make_shared.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/mutex.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/thread.h"
 #include "kudu/util/threadlocal.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/mutex.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mutex.cc b/src/kudu/util/mutex.cc
index bd9539b..d55ccaf 100644
--- a/src/kudu/util/mutex.cc
+++ b/src/kudu/util/mutex.cc
@@ -19,9 +19,16 @@
 
 #include "kudu/util/mutex.h"
 
+#include <cerrno>
+#include <cstdint>
+#include <cstring>
+#include <ostream>
+#include <string>
+
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/walltime.h"
 #include "kudu/util/debug-util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/dns_resolver-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/dns_resolver-test.cc b/src/kudu/util/net/dns_resolver-test.cc
index 55be284..f08b089 100644
--- a/src/kudu/util/net/dns_resolver-test.cc
+++ b/src/kudu/util/net/dns_resolver-test.cc
@@ -17,14 +17,18 @@
 
 #include "kudu/util/net/dns_resolver.h"
 
-#include <boost/bind.hpp>
-#include <gtest/gtest.h>
+#include <ostream>
+#include <string>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/strings/util.h"
-#include "kudu/util/countdown_latch.h"
+#include "kudu/util/async_util.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/net/sockaddr.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 using std::vector;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/dns_resolver.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/dns_resolver.cc b/src/kudu/util/net/dns_resolver.cc
index 4c37a95..8031c10 100644
--- a/src/kudu/util/net/dns_resolver.cc
+++ b/src/kudu/util/net/dns_resolver.cc
@@ -17,15 +17,17 @@
 
 #include "kudu/util/net/dns_resolver.h"
 
-#include <boost/bind.hpp>
+#include <vector>
+
+#include <boost/bind.hpp> // IWYU pragma: keep
 #include <gflags/gflags.h>
 #include <glog/logging.h>
-#include <vector>
 
+#include "kudu/gutil/callback.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/threadpool.h"
 #include "kudu/util/net/net_util.h"
-#include "kudu/util/net/sockaddr.h"
+#include "kudu/util/status.h"
 
 DEFINE_int32(dns_num_resolver_threads, 1, "The number of threads to use for DNS resolution");
 TAG_FLAG(dns_num_resolver_threads, advanced);

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/dns_resolver.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/dns_resolver.h b/src/kudu/util/net/dns_resolver.h
index 4232174..06dfa48 100644
--- a/src/kudu/util/net/dns_resolver.h
+++ b/src/kudu/util/net/dns_resolver.h
@@ -21,8 +21,7 @@
 
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
-#include "kudu/util/async_util.h"
-#include "kudu/util/status.h"
+#include "kudu/util/status_callback.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/net_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/net_util-test.cc b/src/kudu/util/net/net_util-test.cc
index 3316316..1717d04 100644
--- a/src/kudu/util/net/net_util-test.cc
+++ b/src/kudu/util/net/net_util-test.cc
@@ -15,18 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gtest/gtest.h>
-
 #include <algorithm>
+#include <cstdint>
+#include <ostream>
 #include <string>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/util.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/net/socket.h"
 #include "kudu/util/net/sockaddr.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/net_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/net_util.cc b/src/kudu/util/net/net_util.cc
index 94dbb02..e5918b0 100644
--- a/src/kudu/util/net/net_util.cc
+++ b/src/kudu/util/net/net_util.cc
@@ -15,24 +15,31 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <arpa/inet.h>
+#include <sys/socket.h>
 #include <ifaddrs.h>
+#include <limits.h>
 #include <netdb.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
 
 #include <algorithm>
+#include <cerrno>
+#include <cstring>
 #include <functional>
 #include <memory>
+#include <ostream>
 #include <unordered_set>
 #include <utility>
 #include <vector>
 
-#include <boost/functional/hash.hpp>
+#include <boost/functional/hash/hash.hpp>
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 
 #include "kudu/gutil/endian.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/numbers.h"
 #include "kudu/gutil/strings/split.h"
@@ -41,7 +48,6 @@
 #include "kudu/gutil/strings/util.h"
 #include "kudu/util/debug/trace_event.h"
 #include "kudu/util/errno.h"
-#include "kudu/util/faststring.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/net/sockaddr.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/net_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/net_util.h b/src/kudu/util/net/net_util.h
index b246c5e..c471ae8 100644
--- a/src/kudu/util/net/net_util.h
+++ b/src/kudu/util/net/net_util.h
@@ -17,6 +17,8 @@
 #ifndef KUDU_UTIL_NET_NET_UTIL_H
 #define KUDU_UTIL_NET_NET_UTIL_H
 
+#include <cstddef>
+#include <cstdint>
 #include <string>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/sockaddr.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/sockaddr.cc b/src/kudu/util/net/sockaddr.cc
index 0379382..428d4bd 100644
--- a/src/kudu/util/net/sockaddr.cc
+++ b/src/kudu/util/net/sockaddr.cc
@@ -18,15 +18,16 @@
 #include "kudu/util/net/sockaddr.h"
 
 #include <arpa/inet.h>
-#include <errno.h>
 #include <netdb.h>
-#include <stdio.h>
-#include <string.h>
+#include <sys/socket.h>
+
+#include <cerrno>
+#include <cstring>
 #include <string>
 
 #include "kudu/gutil/endian.h"
 #include "kudu/gutil/hash/builtin_type_hash.h"
-#include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/net/net_util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/sockaddr.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/sockaddr.h b/src/kudu/util/net/sockaddr.h
index 09777f3..3253b39 100644
--- a/src/kudu/util/net/sockaddr.h
+++ b/src/kudu/util/net/sockaddr.h
@@ -18,7 +18,9 @@
 #define KUDU_UTIL_NET_SOCKADDR_H
 
 #include <netinet/in.h>
-#include <iosfwd>
+
+#include <cstdint>
+#include <functional>
 #include <string>
 
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/socket.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/socket.cc b/src/kudu/util/net/socket.cc
index 748c773..a7ccfcc 100644
--- a/src/kudu/util/net/socket.cc
+++ b/src/kudu/util/net/socket.cc
@@ -17,20 +17,25 @@
 
 #include "kudu/util/net/socket.h"
 
-#include <errno.h>
 #include <fcntl.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <sys/socket.h>
-#include <sys/types.h>
+#include <sys/time.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cinttypes>
+#include <cstring>
 #include <limits>
+#include <ostream>
 #include <string>
 
+#include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include "kudu/gutil/basictypes.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/debug/trace_event.h"
@@ -41,7 +46,7 @@
 #include "kudu/util/net/sockaddr.h"
 #include "kudu/util/random.h"
 #include "kudu/util/random_util.h"
-#include "kudu/util/subprocess.h"
+#include "kudu/util/slice.h"
 
 DEFINE_string(local_ip_for_outbound_sockets, "",
               "IP to bind to when making outgoing socket connections. "

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/net/socket.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/socket.h b/src/kudu/util/net/socket.h
index 7c04ff6..bc86634 100644
--- a/src/kudu/util/net/socket.h
+++ b/src/kudu/util/net/socket.h
@@ -17,12 +17,15 @@
 #ifndef KUDU_UTIL_NET_SOCKET_H
 #define KUDU_UTIL_NET_SOCKET_H
 
-#include <sys/uio.h>
+#include <cstddef>
+#include <cstdint>
 #include <string>
 
 #include "kudu/gutil/macros.h"
 #include "kudu/util/status.h"
 
+struct iovec;
+
 namespace kudu {
 
 class MonoDelta;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/nvm_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/nvm_cache.cc b/src/kudu/util/nvm_cache.cc
index 7346f21..fef188c 100644
--- a/src/kudu/util/nvm_cache.cc
+++ b/src/kudu/util/nvm_cache.cc
@@ -20,27 +20,33 @@
 
 #include "kudu/util/nvm_cache.h"
 
-#include <gflags/gflags.h>
-#include <glog/logging.h>
+#include <cstdint>
+#include <cstring>
 #include <iostream>
-#include <libvmem.h>
 #include <memory>
 #include <mutex>
-#include <stdlib.h>
 #include <string>
 #include <vector>
 
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+#include <libvmem.h>
+
+#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/atomic_refcount.h"
+#include "kudu/gutil/dynamic_annotations.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/hash/city.h"
+#include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/stl_util.h"
-#include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/atomic.h"
 #include "kudu/util/cache.h"
 #include "kudu/util/cache_metrics.h"
-#include "kudu/util/flags.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/locks.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/slice.h"
 
 DEFINE_string(nvm_cache_path, "/vmem",
               "The path at which the NVM cache will try to allocate its memory. "
@@ -62,8 +68,6 @@ TAG_FLAG(nvm_cache_simulate_allocation_failure, unsafe);
 
 namespace kudu {
 
-class MetricEntity;
-
 namespace {
 
 using std::shared_ptr;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/nvm_cache.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/nvm_cache.h b/src/kudu/util/nvm_cache.h
index 38962f2..9a65316 100644
--- a/src/kudu/util/nvm_cache.h
+++ b/src/kudu/util/nvm_cache.h
@@ -17,6 +17,7 @@
 #ifndef KUDU_UTIL_NVM_CACHE_H_
 #define KUDU_UTIL_NVM_CACHE_H_
 
+#include <cstddef>
 #include <string>
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/object_pool-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/object_pool-test.cc b/src/kudu/util/object_pool-test.cc
index d6b34ae..954b834 100644
--- a/src/kudu/util/object_pool-test.cc
+++ b/src/kudu/util/object_pool-test.cc
@@ -16,6 +16,9 @@
 // under the License.
 
 #include <gtest/gtest.h>
+
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/move.h"
 #include "kudu/util/object_pool.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/oid_generator-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/oid_generator-test.cc b/src/kudu/util/oid_generator-test.cc
index a38b496..be88061 100644
--- a/src/kudu/util/oid_generator-test.cc
+++ b/src/kudu/util/oid_generator-test.cc
@@ -17,10 +17,12 @@
 
 #include "kudu/util/oid_generator.h"
 
-#include <gtest/gtest.h>
 #include <string>
 
-#include "kudu/util/test_util.h"
+#include <gtest/gtest.h>
+
+#include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 
 using std::string;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/oid_generator.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/oid_generator.cc b/src/kudu/util/oid_generator.cc
index 4e558bf..eee7316 100644
--- a/src/kudu/util/oid_generator.cc
+++ b/src/kudu/util/oid_generator.cc
@@ -17,11 +17,13 @@
 
 #include "kudu/util/oid_generator.h"
 
-#include <boost/uuid/uuid_generators.hpp>
+#include <cstdint>
 #include <exception>
 #include <mutex>
 #include <string>
 
+#include <boost/uuid/uuid.hpp>
+
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/oid_generator.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/oid_generator.h b/src/kudu/util/oid_generator.h
index 7acccc9..c1cc88f 100644
--- a/src/kudu/util/oid_generator.h
+++ b/src/kudu/util/oid_generator.h
@@ -18,9 +18,11 @@
 #ifndef KUDU_UTIL_OID_GENERATOR_H
 #define KUDU_UTIL_OID_GENERATOR_H
 
-#include <boost/uuid/uuid_generators.hpp>
 #include <string>
 
+#include <boost/uuid/random_generator.hpp>
+#include <boost/uuid/string_generator.hpp>
+
 #include "kudu/gutil/macros.h"
 #include "kudu/util/locks.h"
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/once-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/once-test.cc b/src/kudu/util/once-test.cc
index 8ccd8b6..e5eecc7 100644
--- a/src/kudu/util/once-test.cc
+++ b/src/kudu/util/once-test.cc
@@ -15,13 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <ostream>
 #include <vector>
 
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "kudu/gutil/bind.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/once.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/thread.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/os-util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/os-util-test.cc b/src/kudu/util/os-util-test.cc
index b7a59d5..a96e69d 100644
--- a/src/kudu/util/os-util-test.cc
+++ b/src/kudu/util/os-util-test.cc
@@ -17,10 +17,13 @@
 
 #include "kudu/util/os-util.h"
 
+#include <unistd.h>
+
+#include <string>
+
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/errno.h"
 #include "kudu/util/test_macros.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/os-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/os-util.cc b/src/kudu/util/os-util.cc
index 5fedc4d..8277821 100644
--- a/src/kudu/util/os-util.cc
+++ b/src/kudu/util/os-util.cc
@@ -25,17 +25,20 @@
 #include "kudu/util/os-util.h"
 
 #include <fcntl.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+#include <glog/logging.h>
+
+#include <cstddef>
 #include <fstream>
-#include <sstream>
 #include <string>
-#include <sys/resource.h>
 #include <vector>
-#include <unistd.h>
 
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/strings/numbers.h"
 #include "kudu/gutil/strings/split.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/errno.h"
 
 using std::ifstream;
 using std::istreambuf_iterator;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/os-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/os-util.h b/src/kudu/util/os-util.h
index a5f80f7..bd1a444 100644
--- a/src/kudu/util/os-util.h
+++ b/src/kudu/util/os-util.h
@@ -23,6 +23,7 @@
 #ifndef KUDU_UTIL_OS_UTIL_H
 #define KUDU_UTIL_OS_UTIL_H
 
+#include <cstdint>
 #include <string>
 
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/path_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/path_util.cc b/src/kudu/util/path_util.cc
index 091950a..201bac6 100644
--- a/src/kudu/util/path_util.cc
+++ b/src/kudu/util/path_util.cc
@@ -20,15 +20,19 @@
 // Use the POSIX version of dirname(3).
 #include <libgen.h>
 
-#include <glog/logging.h>
+#include <cstring>
+#if defined(__APPLE__)
+#include <mutex>
+#endif // defined(__APPLE__)
+#include <ostream>
 #include <string>
 
+#include <glog/logging.h>
+
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/strings/split.h"
+#include "kudu/gutil/strings/stringpiece.h"
 
-#if defined(__APPLE__)
-#include <mutex>
-#endif // defined(__APPLE__)
 
 using std::string;
 using std::vector;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pb_util-internal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util-internal.cc b/src/kudu/util/pb_util-internal.cc
index d891d75..380072c 100644
--- a/src/kudu/util/pb_util-internal.cc
+++ b/src/kudu/util/pb_util-internal.cc
@@ -16,6 +16,9 @@
 // under the License.
 #include "kudu/util/pb_util-internal.h"
 
+#include <ostream>
+#include <string>
+
 namespace kudu {
 namespace pb_util {
 namespace internal {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pb_util-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util-internal.h b/src/kudu/util/pb_util-internal.h
index 770d730..b148166 100644
--- a/src/kudu/util/pb_util-internal.h
+++ b/src/kudu/util/pb_util-internal.h
@@ -20,12 +20,18 @@
 #ifndef KUDU_UTIL_PB_UTIL_INTERNAL_H
 #define KUDU_UTIL_PB_UTIL_INTERNAL_H
 
+#include <cstddef>
+#include <cstdint>
 #include <memory>
 
 #include <glog/logging.h>
 #include <google/protobuf/io/zero_copy_stream.h>
 
+#include "kudu/gutil/integral_types.h"
+#include "kudu/gutil/port.h"
 #include "kudu/util/env.h"
+#include "kudu/util/slice.h"
+#include "kudu/util/status.h"
 
 namespace kudu {
 namespace pb_util {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pb_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util-test.cc b/src/kudu/util/pb_util-test.cc
index eddc799..9db30bf 100644
--- a/src/kudu/util/pb_util-test.cc
+++ b/src/kudu/util/pb_util-test.cc
@@ -15,17 +15,21 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <sys/types.h>
-#include <unistd.h>
-
+#include <algorithm>
+#include <cstdint>
+#include <ostream>
 #include <memory>
 #include <string>
 #include <vector>
 
-#include <gflags/gflags_declare.h>
+#include <google/protobuf/descriptor.h>
 #include <google/protobuf/descriptor.pb.h>
+#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
+#include "kudu/gutil/port.h"
+#include "kudu/util/faststring.h"
+#include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
 #include "kudu/util/pb_util-internal.h"
 #include "kudu/util/pb_util.h"
@@ -33,7 +37,9 @@
 #include "kudu/util/proto_container_test.pb.h"
 #include "kudu/util/proto_container_test2.pb.h"
 #include "kudu/util/proto_container_test3.pb.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pb_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util.cc b/src/kudu/util/pb_util.cc
index 0c09712..f2fd3d8 100644
--- a/src/kudu/util/pb_util.cc
+++ b/src/kudu/util/pb_util.cc
@@ -23,12 +23,13 @@
 
 #include "kudu/util/pb_util.h"
 
+#include <algorithm>
+#include <cstddef>
 #include <deque>
 #include <initializer_list>
 #include <memory>
 #include <mutex>
-#include <ostream>
-#include <sstream>
+#include <ostream>  // IWYU pragma: keep
 #include <string>
 #include <unordered_set>
 #include <vector>
@@ -39,16 +40,17 @@
 #include <google/protobuf/descriptor_database.h>
 #include <google/protobuf/dynamic_message.h>
 #include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/io/zero_copy_stream.h>
 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/message_lite.h>
+#include <google/protobuf/stubs/status.h>
 #include <google/protobuf/text_format.h>
 #include <google/protobuf/util/json_util.h>
 
-#include "kudu/gutil/bind.h"
-#include "kudu/gutil/callback.h"
+#include "kudu/gutil/integral_types.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/escaping.h"
 #include "kudu/gutil/strings/fastmem.h"
 #include "kudu/gutil/strings/substitute.h"
@@ -59,12 +61,13 @@
 #include "kudu/util/debug/trace_event.h"
 #include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/jsonwriter.h"
 #include "kudu/util/logging.h"
-#include "kudu/util/mutex.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/pb_util-internal.h"
 #include "kudu/util/pb_util.pb.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 
 using google::protobuf::Descriptor;
@@ -427,9 +430,9 @@ void SerializeToString(const MessageLite &msg, faststring *output) {
 }
 
 Status ParseFromSequentialFile(MessageLite *msg, SequentialFile *rfile) {
-  SequentialFileFileInputStream istream(rfile);
-  if (!msg->ParseFromZeroCopyStream(&istream)) {
-    RETURN_NOT_OK(istream.status());
+  SequentialFileFileInputStream input(rfile);
+  if (!msg->ParseFromZeroCopyStream(&input)) {
+    RETURN_NOT_OK(input.status());
 
     // If it's not a file IO error then it's a parsing error.
     // Probably, we read wrong or damaged data here.
@@ -455,9 +458,9 @@ Status WritePBToPath(Env* env, const std::string& path,
   RETURN_NOT_OK(env->NewTempWritableFile(WritableFileOptions(), tmp_template, &tmp_path, &file));
   env_util::ScopedFileDeleter tmp_deleter(env, tmp_path);
 
-  WritableFileOutputStream ostream(file.get());
-  bool res = msg.SerializeToZeroCopyStream(&ostream);
-  if (!res || !ostream.Flush()) {
+  WritableFileOutputStream output(file.get());
+  bool res = msg.SerializeToZeroCopyStream(&output);
+  if (!res || !output.Flush()) {
     return Status::IOError("Unable to serialize PB to file");
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pb_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util.h b/src/kudu/util/pb_util.h
index d74784b..c3d0f4e 100644
--- a/src/kudu/util/pb_util.h
+++ b/src/kudu/util/pb_util.h
@@ -21,22 +21,23 @@
 #ifndef KUDU_UTIL_PB_UTIL_H
 #define KUDU_UTIL_PB_UTIL_H
 
+#include <cstdint>
+#include <iosfwd>
 #include <memory>
 #include <string>
 
+#include <google/protobuf/message.h>
 #include <gtest/gtest_prod.h>
 
-#include "kudu/util/debug/trace_event.h"
-#include "kudu/util/faststring.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/mutex.h"
+#include "kudu/util/debug/trace_event_impl.h"
 
 namespace google {
 namespace protobuf {
 class DescriptorPool;
 class FileDescriptor;
 class FileDescriptorSet;
-class Message;
-class MessageFactory;
 class MessageLite;
 class SimpleDescriptorDatabase;
 } // namespace protobuf
@@ -50,6 +51,7 @@ class SequentialFile;
 class Slice;
 class Status;
 class RWFile;
+class faststring;
 
 namespace pb_util {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/process_memory-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/process_memory-test.cc b/src/kudu/util/process_memory-test.cc
index 38922f5..36df1a9 100644
--- a/src/kudu/util/process_memory-test.cc
+++ b/src/kudu/util/process_memory-test.cc
@@ -16,12 +16,16 @@
 // under the License.
 
 #include <atomic>
+#include <cstdint>
+#include <ostream>
 #include <thread>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/util/monotime.h"
 #include "kudu/util/process_memory.h"
-#include "kudu/util/test_util.h"
 
 using std::atomic;
 using std::thread;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/process_memory.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/process_memory.cc b/src/kudu/util/process_memory.cc
index 3ffcc43..7c0d4ee 100644
--- a/src/kudu/util/process_memory.cc
+++ b/src/kudu/util/process_memory.cc
@@ -15,21 +15,30 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <sys/resource.h>
+#include <cstddef>
+#include <memory>
+#include <ostream>
+#include <string>
 
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 #include <gperftools/malloc_extension.h>
 
+#include "kudu/gutil/atomicops.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/once.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/gutil/walltime.h"
-#include "kudu/util/debug/trace_event.h"
+#include "kudu/gutil/walltime.h"          // IWYU pragma: keep
+#include "kudu/util/debug/trace_event.h"  // IWYU pragma: keep
 #include "kudu/util/env.h"
 #include "kudu/util/flag_tags.h"
-#include "kudu/util/mem_tracker.h"
+#include "kudu/util/locks.h"
+#include "kudu/util/mem_tracker.h"        // IWYU pragma: keep
 #include "kudu/util/process_memory.h"
 #include "kudu/util/random.h"
-#include "kudu/util/striped64.h"
+#include "kudu/util/status.h"
 
 DEFINE_int64(memory_limit_hard_bytes, 0,
              "Maximum amount of memory this daemon should use, in bytes. "

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/protoc-gen-insertions.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/protoc-gen-insertions.cc b/src/kudu/util/protoc-gen-insertions.cc
index cd87c87..5d1097e 100644
--- a/src/kudu/util/protoc-gen-insertions.cc
+++ b/src/kudu/util/protoc-gen-insertions.cc
@@ -18,13 +18,17 @@
 // Simple protoc plugin which inserts some code at the top of each generated protobuf.
 // Currently, this just adds an include of protobuf-annotations.h, a file which hooks up
 // the protobuf concurrency annotations to our TSAN annotations.
-#include <glog/logging.h>
+
+#include <string>
+
 #include <google/protobuf/compiler/code_generator.h>
 #include <google/protobuf/compiler/plugin.h>
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/io/zero_copy_stream.h>
+
 #include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/strip.h"
 #include "kudu/gutil/strings/substitute.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pstack_watcher-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pstack_watcher-test.cc b/src/kudu/util/pstack_watcher-test.cc
index 652fec2..abc39e4 100644
--- a/src/kudu/util/pstack_watcher-test.cc
+++ b/src/kudu/util/pstack_watcher-test.cc
@@ -17,17 +17,22 @@
 
 #include "kudu/util/pstack_watcher.h"
 
-#include <gtest/gtest.h>
-#include <memory>
-#include <poll.h>
-#include <stdio.h>
 #include <unistd.h>
-#include <vector>
+
+#include <cerrno>
+#include <memory>
+#include <cstdio>
+#include <string>
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/bitmap.h"
 #include "kudu/util/env.h"
 #include "kudu/util/errno.h"
+#include "kudu/util/faststring.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 
 using std::shared_ptr;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pstack_watcher.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pstack_watcher.cc b/src/kudu/util/pstack_watcher.cc
index 1963f99..6cf63d3 100644
--- a/src/kudu/util/pstack_watcher.cc
+++ b/src/kudu/util/pstack_watcher.cc
@@ -17,18 +17,23 @@
 
 #include "kudu/util/pstack_watcher.h"
 
+#include <unistd.h>
+
+#include <cerrno>
+#include <cstdio>
 #include <memory>
-#include <stdio.h>
 #include <string>
-#include <sys/types.h>
-#include <unistd.h>
 #include <vector>
 
+#include <boost/bind.hpp>
+#include <glog/logging.h>
+
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/env.h"
 #include "kudu/util/errno.h"
 #include "kudu/util/status.h"
 #include "kudu/util/subprocess.h"
+#include "kudu/util/thread.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/pstack_watcher.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/pstack_watcher.h b/src/kudu/util/pstack_watcher.h
index 396bf94..5d11d3d 100644
--- a/src/kudu/util/pstack_watcher.h
+++ b/src/kudu/util/pstack_watcher.h
@@ -17,17 +17,21 @@
 #ifndef KUDU_UTIL_PSTACK_WATCHER_H
 #define KUDU_UTIL_PSTACK_WATCHER_H
 
+#include <sys/types.h>
+
 #include <string>
 #include <vector>
 
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/condition_variable.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/mutex.h"
 #include "kudu/util/status.h"
-#include "kudu/util/thread.h"
 
 namespace kudu {
 
+class Thread;
+
 // PstackWatcher is an object which will pstack the current process and print
 // the results to stdout.  It does this after a certain timeout has occured.
 class PstackWatcher {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/random-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/random-test.cc b/src/kudu/util/random-test.cc
index 0528b93..26c7ab5 100644
--- a/src/kudu/util/random-test.cc
+++ b/src/kudu/util/random-test.cc
@@ -15,10 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cmath>
+#include <cstdint>
 #include <limits>
 #include <unordered_set>
+#include <vector>
 
-#include <glog/stl_logging.h>
+#include <gtest/gtest.h>
 
 #include "kudu/util/random.h"
 #include "kudu/util/test_util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/random_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/random_util-test.cc b/src/kudu/util/random_util-test.cc
index f3eb7d5..993ef15 100644
--- a/src/kudu/util/random_util-test.cc
+++ b/src/kudu/util/random_util-test.cc
@@ -17,9 +17,11 @@
 
 #include "kudu/util/random_util.h"
 
-#include <algorithm>
-#include <cmath>
 #include <cstring>
+#include <ostream>
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
 
 #include "kudu/util/random.h"
 #include "kudu/util/test_util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/random_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/random_util.cc b/src/kudu/util/random_util.cc
index 21a4144..a102a32 100644
--- a/src/kudu/util/random_util.cc
+++ b/src/kudu/util/random_util.cc
@@ -17,11 +17,10 @@
 
 #include "kudu/util/random_util.h"
 
-#include <cmath>
+#include <unistd.h>
+
 #include <cstdlib>
 #include <cstring>
-#include <sys/types.h>
-#include <unistd.h>
 
 #include "kudu/util/env.h"
 #include "kudu/util/random.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/resettable_heartbeater-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/resettable_heartbeater-test.cc b/src/kudu/util/resettable_heartbeater-test.cc
index 0e4cf3b..e3989b7 100644
--- a/src/kudu/util/resettable_heartbeater-test.cc
+++ b/src/kudu/util/resettable_heartbeater-test.cc
@@ -17,15 +17,19 @@
 
 #include "kudu/util/resettable_heartbeater.h"
 
-#include <boost/bind.hpp>
-#include <gtest/gtest.h>
+#include <cstdint>
+#include <ostream>
 #include <string>
 
+#include <boost/bind.hpp> // IWYU pragma: keep
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/util/countdown_latch.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/resettable_heartbeater.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/resettable_heartbeater.cc b/src/kudu/util/resettable_heartbeater.cc
index 848590c..5ec87fc 100644
--- a/src/kudu/util/resettable_heartbeater.cc
+++ b/src/kudu/util/resettable_heartbeater.cc
@@ -17,13 +17,19 @@
 
 #include "kudu/util/resettable_heartbeater.h"
 
-#include <glog/logging.h>
+#include <algorithm>
+#include <cstdint>
+#include <cstdlib>
 #include <mutex>
+#include <ostream>
+
+#include <glog/logging.h>
 
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/locks.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/random.h"
 #include "kudu/util/status.h"
 #include "kudu/util/thread.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/resettable_heartbeater.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/resettable_heartbeater.h b/src/kudu/util/resettable_heartbeater.h
index 40bbe29..5699f91 100644
--- a/src/kudu/util/resettable_heartbeater.h
+++ b/src/kudu/util/resettable_heartbeater.h
@@ -18,9 +18,10 @@
 #ifndef KUDU_UTIL_RESETTABLE_HEARTBEATER_H_
 #define KUDU_UTIL_RESETTABLE_HEARTBEATER_H_
 
-#include <boost/function.hpp>
 #include <string>
 
+#include <boost/function.hpp>
+
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rle-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rle-test.cc b/src/kudu/util/rle-test.cc
index 874bd71..20d0a27 100644
--- a/src/kudu/util/rle-test.cc
+++ b/src/kudu/util/rle-test.cc
@@ -14,20 +14,29 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#include <stdlib.h>
-#include <stdio.h>
+
+#include <algorithm>
+#include <cstdint>
+#include <cstdlib>
+#include <cstring>
+#include <ostream>
+#include <string>
+#include <vector>
 
 // Must come before gtest.h.
 #include "kudu/gutil/mathlimits.h"
 
 #include <boost/utility/binary.hpp>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
-#include <string>
-#include <vector>
 
-#include "kudu/util/rle-encoding.h"
 #include "kudu/util/bit-stream-utils.h"
+#include "kudu/util/bit-stream-utils.inline.h"
+#include "kudu/util/bit-util.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/hexdump.h"
+#include "kudu/util/rle-encoding.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rolling_log-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rolling_log-test.cc b/src/kudu/util/rolling_log-test.cc
index 3c6f60b..626c0de 100644
--- a/src/kudu/util/rolling_log-test.cc
+++ b/src/kudu/util/rolling_log-test.cc
@@ -17,15 +17,23 @@
 
 #include "kudu/util/rolling_log.h"
 
-#include <glog/logging.h>
-#include <glog/stl_logging.h>
+#include <unistd.h>
+
+#include <cstdint>
 #include <string>
 #include <vector>
 
+#include <glog/stl_logging.h>
+#include <gtest/gtest.h>
+
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/strings/stringpiece.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/strings/util.h"
 #include "kudu/util/env.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/path_util.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rolling_log.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rolling_log.cc b/src/kudu/util/rolling_log.cc
index 486abc0..cc24b8a 100644
--- a/src/kudu/util/rolling_log.cc
+++ b/src/kudu/util/rolling_log.cc
@@ -18,13 +18,16 @@
 #include "kudu/util/rolling_log.h"
 
 #include <unistd.h>
-#include <sys/types.h>
 
+#include <algorithm>
+#include <ctime>
 #include <iomanip>
 #include <memory>
 #include <ostream>
 #include <string>
 
+#include <gflags/gflags.h>
+#include <glog/logging.h>
 #include <zlib.h>
 
 #include "kudu/gutil/strings/numbers.h"
@@ -33,7 +36,7 @@
 #include "kudu/util/env.h"
 #include "kudu/util/net/net_util.h"
 #include "kudu/util/path_util.h"
-#include "kudu/util/thread_restrictions.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/user.h"
 
 using std::ostringstream;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rolling_log.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/rolling_log.h b/src/kudu/util/rolling_log.h
index 2559d6d..01829f0 100644
--- a/src/kudu/util/rolling_log.h
+++ b/src/kudu/util/rolling_log.h
@@ -17,6 +17,7 @@
 #ifndef KUDU_UTIL_ROLLING_LOG_H
 #define KUDU_UTIL_ROLLING_LOG_H
 
+#include <cstdint>
 #include <memory>
 #include <string>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rw_mutex-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rw_mutex-test.cc b/src/kudu/util/rw_mutex-test.cc
index 7f9e376..c2cb394 100644
--- a/src/kudu/util/rw_mutex-test.cc
+++ b/src/kudu/util/rw_mutex-test.cc
@@ -15,12 +15,15 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gtest/gtest.h>
+#include <cstdint>
 #include <mutex>
+#include <ostream>
 #include <thread>
 #include <vector>
 
-#include "kudu/gutil/integral_types.h"
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/util/atomic.h"
 #include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rw_mutex.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rw_mutex.cc b/src/kudu/util/rw_mutex.cc
index 6dd8f3e..59139af 100644
--- a/src/kudu/util/rw_mutex.cc
+++ b/src/kudu/util/rw_mutex.cc
@@ -17,8 +17,12 @@
 
 #include "kudu/util/rw_mutex.h"
 
-#include <glog/logging.h>
+#include <cerrno>
+#include <cstring>
 #include <mutex>
+#include <ostream>
+
+#include <glog/logging.h>
 
 #include "kudu/gutil/map-util.h"
 #include "kudu/util/env.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rw_mutex.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/rw_mutex.h b/src/kudu/util/rw_mutex.h
index 969f2be..84f77d2 100644
--- a/src/kudu/util/rw_mutex.h
+++ b/src/kudu/util/rw_mutex.h
@@ -18,6 +18,8 @@
 #pragma once
 
 #include <pthread.h>
+#include <sys/types.h>
+
 #include <unordered_set>
 
 #include "kudu/gutil/macros.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rw_semaphore-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rw_semaphore-test.cc b/src/kudu/util/rw_semaphore-test.cc
index d12fda1..7717608 100644
--- a/src/kudu/util/rw_semaphore-test.cc
+++ b/src/kudu/util/rw_semaphore-test.cc
@@ -15,11 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gtest/gtest.h>
+#include <cstdint>
 #include <mutex>
 #include <thread>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/rw_semaphore.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rwc_lock-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rwc_lock-test.cc b/src/kudu/util/rwc_lock-test.cc
index 99c8071..17c2b19 100644
--- a/src/kudu/util/rwc_lock-test.cc
+++ b/src/kudu/util/rwc_lock-test.cc
@@ -20,10 +20,14 @@
 #include <thread>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/atomicops.h"
+#include "kudu/util/locks.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/rwc_lock.h"
 #include "kudu/util/test_util.h"
-#include "kudu/util/locks.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rwc_lock.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/rwc_lock.cc b/src/kudu/util/rwc_lock.cc
index efe3ccc..0749822 100644
--- a/src/kudu/util/rwc_lock.cc
+++ b/src/kudu/util/rwc_lock.cc
@@ -22,7 +22,6 @@
 #ifndef NDEBUG
 #include "kudu/gutil/walltime.h"
 #include "kudu/util/debug-util.h"
-#include "kudu/util/env.h"
 #include "kudu/util/thread.h"
 #endif // NDEBUG
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/rwc_lock.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/rwc_lock.h b/src/kudu/util/rwc_lock.h
index 6d4cb70..98c7965 100644
--- a/src/kudu/util/rwc_lock.h
+++ b/src/kudu/util/rwc_lock.h
@@ -17,6 +17,8 @@
 #ifndef KUDU_UTIL_RWC_LOCK_H
 #define KUDU_UTIL_RWC_LOCK_H
 
+#include <cstdint>
+
 #include "kudu/gutil/macros.h"
 #include "kudu/util/condition_variable.h"
 #include "kudu/util/mutex.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/semaphore.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/semaphore.cc b/src/kudu/util/semaphore.cc
index 985da44..d9bc5a5 100644
--- a/src/kudu/util/semaphore.cc
+++ b/src/kudu/util/semaphore.cc
@@ -18,8 +18,18 @@
 #include "kudu/util/semaphore.h"
 
 #include <semaphore.h>
+
+#include <cerrno>
+#include <cstdint>
+#include <cstdlib>
+#include <ctime>
+#include <ostream>
+
 #include <glog/logging.h>
+
 #include "kudu/gutil/walltime.h"
+#include "kudu/util/monotime.h"
+
 namespace kudu {
 
 Semaphore::Semaphore(int capacity) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/semaphore.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/semaphore.h b/src/kudu/util/semaphore.h
index 88a1086..4f12658 100644
--- a/src/kudu/util/semaphore.h
+++ b/src/kudu/util/semaphore.h
@@ -25,10 +25,11 @@
 
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
-#include "kudu/util/monotime.h"
 
 namespace kudu {
 
+class MonoDelta;
+
 // Wrapper for POSIX semaphores.
 class Semaphore {
  public:

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/semaphore_macosx.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/semaphore_macosx.cc b/src/kudu/util/semaphore_macosx.cc
index 7cc5f08..e2d235c 100644
--- a/src/kudu/util/semaphore_macosx.cc
+++ b/src/kudu/util/semaphore_macosx.cc
@@ -18,8 +18,11 @@
 #include "kudu/util/semaphore.h"
 
 #include <semaphore.h>
+
 #include <glog/logging.h>
+
 #include "kudu/gutil/walltime.h"
+#include "kudu/util/monotime.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/signal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/signal.cc b/src/kudu/util/signal.cc
index 2de3000..e8b6e79 100644
--- a/src/kudu/util/signal.cc
+++ b/src/kudu/util/signal.cc
@@ -17,7 +17,7 @@
 
 #include "kudu/util/signal.h"
 
-#include "kudu/util/logging.h"
+#include <glog/logging.h>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/slice-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/slice-test.cc b/src/kudu/util/slice-test.cc
index b0d3bef..0f7a893 100644
--- a/src/kudu/util/slice-test.cc
+++ b/src/kudu/util/slice-test.cc
@@ -17,6 +17,11 @@
 
 #include "kudu/util/slice.h"
 
+#include <cstdint>
+#include <map>
+#include <string>
+#include <utility>
+
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/map-util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/slice.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/slice.cc b/src/kudu/util/slice.cc
index 7e6ab50..5d672ae 100644
--- a/src/kudu/util/slice.cc
+++ b/src/kudu/util/slice.cc
@@ -17,6 +17,9 @@
 
 #include "kudu/util/slice.h"
 
+#include <cctype>
+
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/util/status.h"
 #include "kudu/util/logging.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/slice.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/slice.h b/src/kudu/util/slice.h
index 8738a5d..72ad305 100644
--- a/src/kudu/util/slice.h
+++ b/src/kudu/util/slice.h
@@ -7,11 +7,15 @@
 #ifndef KUDU_UTIL_SLICE_H_
 #define KUDU_UTIL_SLICE_H_
 
-#include <assert.h>
-#include <map>
-#include <stddef.h>
+// NOTE: using stdint.h instead of cstdint because this file is supposed
+//       to be processed by a compiler lacking C++11 support.
 #include <stdint.h>
-#include <string.h>
+
+#include <cassert>
+#include <cstddef>
+#include <cstring>
+#include <iosfwd>
+#include <map>
 #include <string>
 
 #ifdef KUDU_HEADERS_USE_RICH_SLICE

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/spinlock_profiling-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/spinlock_profiling-test.cc b/src/kudu/util/spinlock_profiling-test.cc
index 54d8327..5a9fd6b 100644
--- a/src/kudu/util/spinlock_profiling-test.cc
+++ b/src/kudu/util/spinlock_profiling-test.cc
@@ -15,12 +15,18 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstdint>
+#include <ostream>
+#include <string>
+
 #include <gtest/gtest.h>
 #include <glog/logging.h>
-#include <strstream>
 
+#include "kudu/gutil/integral_types.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/spinlock.h"
 #include "kudu/util/spinlock_profiling.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/trace.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/spinlock_profiling.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/spinlock_profiling.cc b/src/kudu/util/spinlock_profiling.cc
index 001f8d5..8e639ac 100644
--- a/src/kudu/util/spinlock_profiling.cc
+++ b/src/kudu/util/spinlock_profiling.cc
@@ -18,21 +18,28 @@
 #include "kudu/util/spinlock_profiling.h"
 
 #include <sstream>
+#include <string>
 
 #include <glog/logging.h>
 #include <gflags/gflags.h>
 
 #include "kudu/gutil/atomicops.h"
-#include "kudu/gutil/basictypes.h"
+#include "kudu/gutil/bind.h"
+#include "kudu/gutil/casts.h"
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/once.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/spinlock.h"
 #include "kudu/gutil/strings/human_readable.h"
 #include "kudu/gutil/sysinfo.h"
+#include "kudu/util/atomic.h"
 #include "kudu/util/debug-util.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/metrics.h"
 #include "kudu/util/striped64.h"
 #include "kudu/util/trace.h"
+#include "kudu/util/trace_metrics.h"
 
 DEFINE_int32(lock_contention_trace_threshold_cycles,
              2000000, // 2M cycles should be about 1ms

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/spinlock_profiling.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/spinlock_profiling.h b/src/kudu/util/spinlock_profiling.h
index d5b5f15..3bfb09e 100644
--- a/src/kudu/util/spinlock_profiling.h
+++ b/src/kudu/util/spinlock_profiling.h
@@ -17,9 +17,9 @@
 #ifndef KUDU_UTIL_SPINLOCK_PROFILING_H
 #define KUDU_UTIL_SPINLOCK_PROFILING_H
 
+#include <cstdint>
 #include <iosfwd>
 
-#include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/stack_watchdog-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/stack_watchdog-test.cc b/src/kudu/util/stack_watchdog-test.cc
index 9bbb097..a08887f 100644
--- a/src/kudu/util/stack_watchdog-test.cc
+++ b/src/kudu/util/stack_watchdog-test.cc
@@ -17,13 +17,18 @@
 
 #include "kudu/util/kernel_stack_watchdog.h"
 
-#include <gflags/gflags.h>
 #include <string>
 #include <vector>
 
+#include <gflags/gflags_declare.h>
+#include <gtest/gtest.h>
+
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/stopwatch.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/status-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/status-test.cc b/src/kudu/util/status-test.cc
index 1ff8182..0112a26 100644
--- a/src/kudu/util/status-test.cc
+++ b/src/kudu/util/status-test.cc
@@ -2,13 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <glog/logging.h>
+#include <algorithm>
+#include <cerrno>
+#include <string>
+
 #include <gtest/gtest.h>
 
-#include <errno.h>
-#include <vector>
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
-#include "kudu/util/test_util.h"
+#include "kudu/util/test_macros.h"
 
 using std::string;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/status.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/status.cc b/src/kudu/util/status.cc
index 2d368dd..1197682 100644
--- a/src/kudu/util/status.cc
+++ b/src/kudu/util/status.cc
@@ -4,8 +4,10 @@
 
 #include "kudu/util/status.h"
 
-#include <stdio.h>
-#include <stdint.h>
+#include <cstdio>
+#include <cstring>
+
+#include <glog/logging.h>
 
 #include "kudu/gutil/strings/fastmem.h"
 #include "kudu/util/malloc.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/status.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/status.h b/src/kudu/util/status.h
index ff65b57..6318e6d 100644
--- a/src/kudu/util/status.h
+++ b/src/kudu/util/status.h
@@ -13,9 +13,12 @@
 #ifndef KUDU_UTIL_STATUS_H_
 #define KUDU_UTIL_STATUS_H_
 
+// NOTE: using stdint.h instead of cstdint and errno.h instead of errno because
+// this file is supposed to be processed by a compiler lacking C++11 support.
 #include <errno.h>
 #include <stdint.h>
 
+#include <cstddef>
 #include <string>
 
 #ifdef KUDU_HEADERS_NO_STUBS

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/status_callback.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/status_callback.cc b/src/kudu/util/status_callback.cc
index 667bfec..a3932b5 100644
--- a/src/kudu/util/status_callback.cc
+++ b/src/kudu/util/status_callback.cc
@@ -17,6 +17,11 @@
 
 #include "kudu/util/status_callback.h"
 
+#include <ostream>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/port.h"
 #include "kudu/util/status.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/string_case-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/string_case-test.cc b/src/kudu/util/string_case-test.cc
index ae166f5..96831a1 100644
--- a/src/kudu/util/string_case-test.cc
+++ b/src/kudu/util/string_case-test.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <string>
+
 #include <gtest/gtest.h>
 
 #include "kudu/util/string_case.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/string_case.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/string_case.cc b/src/kudu/util/string_case.cc
index 141cdc5..7cf60ab 100644
--- a/src/kudu/util/string_case.cc
+++ b/src/kudu/util/string_case.cc
@@ -17,8 +17,11 @@
 
 #include "kudu/util/string_case.h"
 
+#include <cctype>
+#include <cstdint>
+#include <ostream>
+
 #include <glog/logging.h>
-#include <ctype.h>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/striped64-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/striped64-test.cc b/src/kudu/util/striped64-test.cc
index fee07ca..96f3dfc 100644
--- a/src/kudu/util/striped64-test.cc
+++ b/src/kudu/util/striped64-test.cc
@@ -15,11 +15,18 @@
 // specific language governing permissions and limitations
 // under the License.
 
+
+#include <cstdint>
+#include <ostream>
+#include <vector>
+
+#include <gflags/gflags.h>
 #include <glog/logging.h>
 #include <gtest/gtest.h>
-#include <memory>
 
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/atomic.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/striped64.h"
 #include "kudu/util/test_util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/striped64.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/striped64.cc b/src/kudu/util/striped64.cc
index cf6c780..c8636d5 100644
--- a/src/kudu/util/striped64.cc
+++ b/src/kudu/util/striped64.cc
@@ -17,9 +17,17 @@
 
 #include "kudu/util/striped64.h"
 
+#include <mm_malloc.h>
+#include <unistd.h>
+
+#include <cstdlib>
+#include <new>
+#include <ostream>
+#include <glog/logging.h>
+
+#include "kudu/gutil/atomicops.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/random.h"
-#include "kudu/util/threadlocal.h"
 
 using kudu::striped64::internal::Cell;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/striped64.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/striped64.h b/src/kudu/util/striped64.h
index a3b829b..87df22d 100644
--- a/src/kudu/util/striped64.h
+++ b/src/kudu/util/striped64.h
@@ -18,14 +18,13 @@
 #ifndef KUDU_UTIL_STRIPED64_H_
 #define KUDU_UTIL_STRIPED64_H_
 
+#include <cstdint>
+
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #include "kudu/util/atomic.h"
-#include "kudu/util/threadlocal.h"
 
 namespace kudu {
-
-class Striped64;
-
 namespace striped64 {
 namespace internal {
 


Mime
View raw message