You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/09/14 19:59:33 UTC
kudu git commit: [iwyu] introduce Linux system mappings
Repository: kudu
Updated Branches:
refs/heads/master e2c0e1dbd -> fa8620cc7
[iwyu] introduce Linux system mappings
For starters, added the following mappings to achieve better
compatibility across different Linus versions and distros:
* use <linux/kernel.h> even if <linux/sysinfo.h> is available
* use <sys/vfs.h> even if <sys/statfs.h> is available
* use <linux/types.h> as an umbrella header file for various asm types
Change-Id: I4e50f9135fa076e429b26e3919ef19eb5d430173
Reviewed-on: http://gerrit.cloudera.org:8080/8071
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Reviewed-by: Andrew Wong <aw...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/fa8620cc
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/fa8620cc
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/fa8620cc
Branch: refs/heads/master
Commit: fa8620cc7b4dd4205a5a58737a7cc3c21957fe05
Parents: e2c0e1d
Author: Alexey Serbin <as...@cloudera.com>
Authored: Thu Sep 14 08:37:40 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Thu Sep 14 19:58:43 2017 +0000
----------------------------------------------------------------------
build-support/iwyu/iwyu-filter.awk | 3 +-
build-support/iwyu/iwyu.sh | 3 +-
build-support/iwyu/mappings/system-linux.imp | 35 +++++++++++++++++++++++
src/kudu/util/env_posix.cc | 20 ++++++-------
4 files changed, 48 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/fa8620cc/build-support/iwyu/iwyu-filter.awk
----------------------------------------------------------------------
diff --git a/build-support/iwyu/iwyu-filter.awk b/build-support/iwyu/iwyu-filter.awk
index 6576a72..eddcb8c 100644
--- a/build-support/iwyu/iwyu-filter.awk
+++ b/build-support/iwyu/iwyu-filter.awk
@@ -53,7 +53,8 @@
# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/glog.imp;\
# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/gflags.imp;\
# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/kudu.imp;\
-# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/libstdcpp.imp"
+# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/libstdcpp.imp\
+# -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/system-linux.imp"
#
# ../../build-support/enable_devtoolset.sh \
# env CC=$CC CXX=$CXX \
http://git-wip-us.apache.org/repos/asf/kudu/blob/fa8620cc/build-support/iwyu/iwyu.sh
----------------------------------------------------------------------
diff --git a/build-support/iwyu/iwyu.sh b/build-support/iwyu/iwyu.sh
index a2c16cf..6ee6287 100755
--- a/build-support/iwyu/iwyu.sh
+++ b/build-support/iwyu/iwyu.sh
@@ -54,7 +54,8 @@ IWYU_ARGS="\
--mapping_file=$IWYU_MAPPINGS_PATH/glog.imp \
--mapping_file=$IWYU_MAPPINGS_PATH/gtest.imp \
--mapping_file=$IWYU_MAPPINGS_PATH/kudu.imp \
- --mapping_file=$IWYU_MAPPINGS_PATH/libstdcpp.imp"
+ --mapping_file=$IWYU_MAPPINGS_PATH/libstdcpp.imp\
+ --mapping_file=$IWYU_MAPPINGS_PATH/system-linux.imp"
if ! PATH="$PATH:$PWD/../../thirdparty/clang-toolchain/bin" \
python $ROOT/build-support/iwyu/iwyu_tool.py -p . $IWYU_FILE_LIST -- \
http://git-wip-us.apache.org/repos/asf/kudu/blob/fa8620cc/build-support/iwyu/mappings/system-linux.imp
----------------------------------------------------------------------
diff --git a/build-support/iwyu/mappings/system-linux.imp b/build-support/iwyu/mappings/system-linux.imp
new file mode 100644
index 0000000..22235f5
--- /dev/null
+++ b/build-support/iwyu/mappings/system-linux.imp
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#
+# This file contains Linux-specific mappings for IWYU.
+#
+# For instance, some of these mappings take care of variation in system
+# headers between different versions of Linux. From the point of better
+# compatibility, it makes sense to favor the most compatible option
+# among different system versions and flavors.
+#
+
+[
+ { include: ["<asm-generic/int-ll64.h>", private, "<linux/types.h>", public] },
+ { include: ["<asm/int-ll64.h>", private, "<linux/types.h>", public] },
+ { include: ["<asm-generic/int-l64.h>", private, "<linux/types.h>", public] },
+ { include: ["<asm/int-l64.h>", private, "<linux/types.h>", public] },
+ { include: ["<asm/ioctl.h>", private, "<linux/ioctl.h>", public] },
+ { include: ["<linux/sysinfo.h>", private, "<linux/kernel.h>", public] },
+ { symbol: ["statfs", private, "<sys/vfs.h>", public] }
+]
http://git-wip-us.apache.org/repos/asf/kudu/blob/fa8620cc/src/kudu/util/env_posix.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index 3352853..bb7245e 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -17,6 +17,7 @@
#include <unistd.h>
#include <algorithm>
+#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
@@ -25,7 +26,6 @@
#include <map>
#include <memory>
#include <numeric>
-#include <cerrno>
#include <ostream>
#include <string>
#include <type_traits>
@@ -36,21 +36,22 @@
#include "kudu/gutil/atomicops.h"
#include "kudu/gutil/basictypes.h"
-#include "kudu/gutil/bind_helpers.h"
#include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
#include "kudu/gutil/gscoped_ptr.h"
#include "kudu/gutil/macros.h"
#include "kudu/gutil/map-util.h"
#include "kudu/gutil/once.h"
#include "kudu/gutil/port.h"
+#include "kudu/gutil/stringprintf.h"
#include "kudu/gutil/strings/split.h"
#include "kudu/gutil/strings/substitute.h"
#include "kudu/util/debug/trace_event.h"
#include "kudu/util/env.h"
#include "kudu/util/errno.h"
-#include "kudu/util/flags.h"
-#include "kudu/util/flag_tags.h"
#include "kudu/util/fault_injection.h"
+#include "kudu/util/flag_tags.h"
+#include "kudu/util/flags.h"
#include "kudu/util/logging.h"
#include "kudu/util/malloc.h"
#include "kudu/util/monotime.h"
@@ -61,7 +62,6 @@
#include "kudu/util/stopwatch.h"
#include "kudu/util/thread_restrictions.h"
#include "kudu/util/trace.h"
-#include "kudu/gutil/stringprintf.h"
#if defined(__APPLE__)
#include <mach-o/dyld.h>
@@ -70,16 +70,14 @@
#include <linux/falloc.h>
#include <linux/fiemap.h>
#include <linux/fs.h>
-#include <linux/kernel.h> // IWYU pragma: keep
+#include <linux/ioctl.h>
+#include <linux/kernel.h>
#include <linux/magic.h>
+#include <linux/types.h>
#include <sys/ioctl.h>
#include <sys/sysinfo.h>
-#include <sys/vfs.h> // IWYU pragma: keep
+#include <sys/vfs.h>
#endif // defined(__APPLE__)
-// IWYU pragma: no_include <asm/int-ll64.h>
-// IWYU pragma: no_include <asm/ioctl.h>
-// IWYU pragma: no_include <linux/sysinfo.h>
-// IWYU pragma: no_include <sys/statfs.h>
using base::subtle::Atomic64;
using base::subtle::Barrier_AtomicIncrement;