kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject kudu git commit: [iwyu] kudu-specific mappings for std::tr1 entities
Date Thu, 07 Sep 2017 22:17:43 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 9af2046e6 -> 01003ee6b


[iwyu] kudu-specific mappings for std::tr1 entities

Added Kudu-specific IWYU mappings for std::tr1::shared_ptr and friends
from TR1 (those are used in the Kudu C++ client API).

Added --max_line_length=256 IWYU option for better reporting
on the reason for header files inclusion.  If keeping the
default setting of 80 characters, IWYU sometimes omits the information
which symbols require particular header file to be included.

Change-Id: Ia448dedcbb09ee23b30a922c7143df9036490d84
Reviewed-on: http://gerrit.cloudera.org:8080/7998
Reviewed-by: Adar Dembo <adar@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/01003ee6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/01003ee6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/01003ee6

Branch: refs/heads/master
Commit: 01003ee6b4ece19c5e803dcac9d777a421d7c520
Parents: 9af2046
Author: Alexey Serbin <aserbin@cloudera.com>
Authored: Wed Sep 6 23:30:56 2017 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Thu Sep 7 22:16:34 2017 +0000

----------------------------------------------------------------------
 .gitignore                           |  1 +
 build-support/iwyu/iwyu-filter.awk   | 37 ++++++++++++++++---------------
 build-support/iwyu/iwyu.sh           |  2 ++
 build-support/iwyu/mappings/kudu.imp | 34 ++++++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/01003ee6/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index d009ccc..9271774 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,7 @@ oprofile_data
 .kdev4/
 .metadata/
 *.iml
+README.html
 
 # VIM/emacs/other editors stuff
 *.swp

http://git-wip-us.apache.org/repos/asf/kudu/blob/01003ee6/build-support/iwyu/iwyu-filter.awk
----------------------------------------------------------------------
diff --git a/build-support/iwyu/iwyu-filter.awk b/build-support/iwyu/iwyu-filter.awk
index 0d7fa79..6576a72 100644
--- a/build-support/iwyu/iwyu-filter.awk
+++ b/build-support/iwyu/iwyu-filter.awk
@@ -26,22 +26,34 @@
 #   https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md
 #
 # We are using mappings for the boost library (comes with IWYU) and a few
-# custom mappings for gflags, glog, and gtest libraries to address some IWYU
-# quirks (hopefully, those should be resolved as IWYU gets better).
+# custom mappings for gflags, glog, gtest and other libraries to address some
+# IWYU quirks (hopefully, those should be resolved as IWYU gets better).
+# The kudu.imp mappings file is used to provide Kudu-specific mappings.
+#
+# To run the IWYU tool on every C++ source file in the project,
+# use the recipe below.
 #
-# Usage:
 #  1. Run the CMake with -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=<iwyu_cmd_line>
 #
 #     The path to the IWYU binary should be absolute. The path to the binary
 #     and the command-line options should be separated by semicolon
 #     (that's for feeding it into CMake list variables).
 #
-#     E.g., from the build directory (line breaks are just for readability):
+#     Below is the set of commands to run from the build directory to configure
+#     the build accordingly (line breaks are for better readability):
 #
 #     CC=../../thirdparty/clang-toolchain/bin/clang
 #     CXX=../../thirdparty/clang-toolchain/bin/clang++
-#     IWYU="`pwd`../../thirdparty/clang-toolchain/bin/include-what-you-use;\
-#       -Xiwyu;--mapping_file=`pwd`../../build-support/iwyu/mappings/map.imp"
+#     IWYU="`pwd`/../../thirdparty/clang-toolchain/bin/include-what-you-use;\
+#       -Xiwyu;--max_line_length=256;\
+#       -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-all.imp;\
+#       -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-all-private.imp;\
+#       -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-extra.imp;\
+#       -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/gtest.imp;\
+#       -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"
 #
 #     ../../build-support/enable_devtoolset.sh \
 #       env CC=$CC CXX=$CXX \
@@ -52,18 +64,7 @@
 #     NOTE:
 #       Since the Kudu code has some 'ifdef NDEBUG' directives, it's possible
 #       that IWYU would produce different results if run against release, not
-#       debug build. However, we plan to use the tool only with debug builds.
-#
-#     NOTE:
-#       As of now, the appropriate command line for IWYU for Kudu is
-#       IWYU="`pwd`/../../thirdparty/clang-toolchain/bin/include-what-you-use; \
-#         -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-all.imp;\
-#         -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-all-private.imp;\
-#         -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/boost-extra.imp;\
-#         -Xiwyu;--mapping_file=`pwd`/../../build-support/iwyu/mappings/gtest.imp;\
-#         -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/libstdcpp.imp"
+#       debug build. As of now, the tool is used in debug builds only.
 #
 #  2. Run make, separating the output from the IWYU tool into a separate file
 #     (it's possible to use piping the output from the tool to the script

http://git-wip-us.apache.org/repos/asf/kudu/blob/01003ee6/build-support/iwyu/iwyu.sh
----------------------------------------------------------------------
diff --git a/build-support/iwyu/iwyu.sh b/build-support/iwyu/iwyu.sh
index 52e81eb..a2c16cf 100755
--- a/build-support/iwyu/iwyu.sh
+++ b/build-support/iwyu/iwyu.sh
@@ -46,12 +46,14 @@ done
 
 IWYU_MAPPINGS_PATH="$ROOT/build-support/iwyu/mappings"
 IWYU_ARGS="\
+    --max_line_length=256 \
     --mapping_file=$IWYU_MAPPINGS_PATH/boost-all.imp \
     --mapping_file=$IWYU_MAPPINGS_PATH/boost-all-private.imp \
     --mapping_file=$IWYU_MAPPINGS_PATH/boost-extra.imp \
     --mapping_file=$IWYU_MAPPINGS_PATH/gflags.imp \
     --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"
 
 if ! PATH="$PATH:$PWD/../../thirdparty/clang-toolchain/bin" \

http://git-wip-us.apache.org/repos/asf/kudu/blob/01003ee6/build-support/iwyu/mappings/kudu.imp
----------------------------------------------------------------------
diff --git a/build-support/iwyu/mappings/kudu.imp b/build-support/iwyu/mappings/kudu.imp
new file mode 100644
index 0000000..32fed7a
--- /dev/null
+++ b/build-support/iwyu/mappings/kudu.imp
@@ -0,0 +1,34 @@
+# 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 Kudu-specific mappings for IWYU.
+#
+# The mappings for std::tr1::shared_ptr and friends are added to avoid
+# suggestions to include <tr1/memory> for the corresponding symbols.
+# Kudu uses those TR1 entities only to achieve backward compatibility
+# with the C++-03/TR1 specification for the Kudu C++ client API only.
+# The code in the "kudu/client/shared_ptr.h" header provides necessary
+# level of abstraction to handle compilation for both Linux and OS X
+# and should be used in the Kudu code instead of TR1 header files.
+#
+
+[
+  { symbol: ["std::tr1::shared_ptr", private, "\"kudu/client/shared_ptr.h\"", public] },
+  { symbol: ["std::tr1::weak_ptr", private, "\"kudu/client/shared_ptr.h\"", public] },
+  { symbol: ["std::tr1::enable_shared_from_this", private, "\"kudu/client/shared_ptr.h\"",
public] }
+]


Mime
View raw message