[gjs: 8/12] CI: Add standalone header files to IWYU script
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 8/12] CI: Add standalone header files to IWYU script
- Date: Mon, 30 Nov 2020 21:29:29 +0000 (UTC)
commit eeb7e381ad376fffc3e7bf31e99f1a029eed5e0d
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Nov 22 19:17:00 2020 -0800
CI: Add standalone header files to IWYU script
Previously we included standalone header files along with other files on
an ad-hoc basis. This changes the IWYU script to check them all
individually, and remove the individual hacks. This also allows
streamlining the rest of the script a bit.
gi/arg-types-inl.h | 2 --
gjs/jsapi-util-args.h | 2 ++
tools/run_iwyu.sh | 76 ++++++++++++++++++---------------------------------
3 files changed, 29 insertions(+), 51 deletions(-)
---
diff --git a/gi/arg-types-inl.h b/gi/arg-types-inl.h
index ceb2d0f9..3111ca6d 100644
--- a/gi/arg-types-inl.h
+++ b/gi/arg-types-inl.h
@@ -6,8 +6,6 @@
#include <stdint.h>
-#include <type_traits>
-
#include <girepository.h>
#include <glib-object.h> // for GType
#include <glib.h> // for gboolean
diff --git a/gjs/jsapi-util-args.h b/gjs/jsapi-util-args.h
index 13c93943..c1db289a 100644
--- a/gjs/jsapi-util-args.h
+++ b/gjs/jsapi-util-args.h
@@ -17,7 +17,9 @@
#include <js/CallArgs.h>
#include <js/Conversions.h>
+#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
+#include <js/Utility.h> // for UniqueChars
#include <jsapi.h> // for JS_ClearPendingException
#include "gjs/jsapi-util.h"
diff --git a/tools/run_iwyu.sh b/tools/run_iwyu.sh
index b0eda0db..64353017 100755
--- a/tools/run_iwyu.sh
+++ b/tools/run_iwyu.sh
@@ -44,7 +44,8 @@ cd ${BUILDDIR:-_build}
echo "files: $files"
IWYU="python3 $(which iwyu_tool) -p ."
-IWYU_RAW="include-what-you-use -xc++ -std=c++17"
+IWYU_RAW="include-what-you-use -xc++ -std=c++17 -Xiwyu --keep=config.h"
+IWYU_RAW_INC="-I. -I.. $(pkg-config --cflags gobject-introspection-1.0 mozjs-78)"
PRIVATE_MAPPING="-Xiwyu --mapping_file=$SRCDIR/tools/gjs-private-iwyu.imp -Xiwyu --keep=config.h"
PUBLIC_MAPPING="-Xiwyu --mapping_file=$SRCDIR/tools/gjs-public-iwyu.imp"
POSTPROCESS="python3 $SRCDIR/tools/process_iwyu.py"
@@ -52,22 +53,28 @@ EXIT=0
# inline-only files with no implementation file don't appear in the compilation
# database, so iwyu_tool cannot process them
-if should_analyze $SRCDIR/gi/utils-inl.h; then
- if ! $IWYU_RAW $(realpath --relative-to=. $SRCDIR/gi/utils-inl.h) 2>&1 \
- | $POSTPROCESS; then
- EXIT=1
+for FILE in $SRCDIR/gi/arg-types-inl.h $SRCDIR/gi/js-value-inl.h \
+ $SRCDIR/gi/utils-inl.h $SRCDIR/gjs/enum-utils.h \
+ $SRCDIR/gjs/jsapi-util-args.h $SRCDIR/gjs/jsapi-util-root.h \
+ $SRCDIR/modules/cairo-module.h
+do
+ if should_analyze $FILE; then
+ if ! $IWYU_RAW $(realpath --relative-to=. $FILE) $IWYU_RAW_INC 2>&1 \
+ | $POSTPROCESS; then
+ EXIT=1
+ fi
fi
-fi
+done
for FILE in $SRCDIR/gi/*.cpp $SRCDIR/gjs/atoms.cpp $SRCDIR/gjs/byteArray.cpp \
$SRCDIR/gjs/coverage.cpp $SRCDIR/gjs/debugger.cpp \
$SRCDIR/gjs/deprecation.cpp $SRCDIR/gjs/error-types.cpp \
$SRCDIR/gjs/engine.cpp $SRCDIR/gjs/global.cpp $SRCDIR/gjs/importer.cpp \
- $SRCDIR/gjs/jsapi-util-error.cpp $SRCDIR/gjs/jsapi-util-string.cpp \
- $SRCDIR/gjs/module.cpp $SRCDIR/gjs/native.cpp $SRCDIR/gjs/stack.cpp \
- $SRCDIR/modules/cairo-*.cpp $SRCDIR/modules/console.cpp \
- $SRCDIR/modules/print.cpp $SRCDIR/modules/system.cpp $SRCDIR/test/*.cpp \
- $SRCDIR/util/*.cpp $SRCDIR/libgjs-private/*.c
+ $SRCDIR/gjs/jsapi-util*.cpp $SRCDIR/gjs/module.cpp $SRCDIR/gjs/native.cpp \
+ $SRCDIR/gjs/stack.cpp $SRCDIR/modules/cairo-*.cpp \
+ $SRCDIR/modules/console.cpp $SRCDIR/modules/print.cpp \
+ $SRCDIR/modules/system.cpp $SRCDIR/test/*.cpp $SRCDIR/util/*.cpp \
+ $SRCDIR/libgjs-private/*.c
do
if should_analyze $FILE; then
if ! $IWYU $FILE -- $PRIVATE_MAPPING | $POSTPROCESS; then
@@ -76,13 +83,7 @@ do
fi
done
-if should_analyze $SRCDIR/gjs/context.cpp; then
- if ! $IWYU $SRCDIR/gjs/context.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/context-private.h | $POSTPROCESS; then
- EXIT=1
- fi
-fi
-
+# this header file is named differently from its corresponding implementation
if ( should_analyze $SRCDIR/gjs/jsapi-dynamic-class.cpp || \
should_analyze $SRCDIR/gjs/jsapi-class.h ); then
if ! $IWYU $SRCDIR/gjs/jsapi-dynamic-class.cpp -- $PRIVATE_MAPPING \
@@ -91,38 +92,15 @@ if ( should_analyze $SRCDIR/gjs/jsapi-dynamic-class.cpp || \
fi
fi
-if ( should_analyze $SRCDIR/gjs/jsapi-util.cpp ||
- should_analyze $SRCDIR/gjs/jsapi-util-args.h || \
- should_analyze $SRCDIR/gjs/jsapi-util-root.h ); then
- if ! $IWYU $SRCDIR/gjs/jsapi-util.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/jsapi-util-args.h \
- -Xiwyu --check_also=*/gjs/jsapi-util-root.h | $POSTPROCESS; then
- EXIT=1
- fi
-fi
-
-if should_analyze $SRCDIR/gjs/mem.cpp; then
- if ! $IWYU $SRCDIR/gjs/mem.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/mem-private.h | $POSTPROCESS; then
- EXIT=1
- fi
-fi
-
-if should_analyze $SRCDIR/gjs/profiler.cpp; then
- if ! $IWYU $SRCDIR/gjs/profiler.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/profiler-private.h | $POSTPROCESS; then
- EXIT=1
- fi
-fi
-
-if ( should_analyze $SRCDIR/modules/cairo.cpp ||
- should_analyze $SRCDIR/modules/cairo-module.h ); then
- if ! $IWYU $SRCDIR/modules/cairo.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/modules/cairo-module.h \
- -Xiwyu --check_also=*/modules/cairo-private.h | $POSTPROCESS; then
- EXIT=1
+# include header files with private implementation along with their main files
+for STEM in gjs/context gjs/mem gjs/profiler modules/cairo; do
+ if should_analyze $SRCDIR/$STEM.cpp; then
+ if ! $IWYU $SRCDIR/$STEM.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/$STEM-private.h | $POSTPROCESS; then
+ EXIT=1
+ fi
fi
-fi
+done
for FILE in $SRCDIR/gjs/console.cpp $SRCDIR/installed-tests/minijasmine.cpp
do
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]