Skip to content

Commit

Permalink
iwyu.map: add new private header mappings for newer Ubuntu image vers…
Browse files Browse the repository at this point in the history
…ion, speed up IWYU workflow a bit (ihhub#6244)
  • Loading branch information
oleg-derevenetz authored Nov 24, 2022
1 parent 5e17c86 commit 8769696
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Install dependencies
- name: Install dependencies and iwyu
run: |
sudo apt-get -y update
sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext ninja-build iwyu
sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext iwyu
- name: Prepare compile_commands.json
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DUSE_SDL_VERSION=SDL2 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Analyze
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DUSE_SDL_VERSION=SDL2 \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--cxx17ns;-Xiwyu;--mapping_file=$GITHUB_WORKSPACE/iwyu.map"
cmake --build build | tee iwyu-result.txt
! grep "Warning: include-what-you-use reported diagnostics:" iwyu-result.txt > /dev/null
set -o pipefail
iwyu_tool -p build -j 2 -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="$GITHUB_WORKSPACE/iwyu.map" | (grep -E -v "^$|has correct #includes/fwd-decls" || true) \
| tee iwyu-result.txt
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
Expand Down
4 changes: 4 additions & 0 deletions iwyu.map
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[
{ include: [ "<bits/chrono.h>", private, "<chrono>", public ] },
{ include: [ "<bits/getopt_core.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/std_abs.h>", private, "<cmath>", public ] },
{ include: [ "<bits/std_abs.h>", private, "<cstdlib>", public ] },
{ include: [ "<bits/utility.h>", private, "<utility>", public ] },

{ include: [ "<bits/types/struct_tm.h>", private, "<ctime>", public ] },

{ include: [ "<ext/alloc_traits.h>", private, "<memory>", public ] },

{ include: [ "\"begin_code.h\"", private, "<SDL_stdinc.h>", public ] }
Expand Down
3 changes: 2 additions & 1 deletion src/fheroes2/agg/bin_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#ifndef H2BIN_FRM_H
#define H2BIN_FRM_H

#include <algorithm>
// TODO: this header is redundant here, but detected as required by IWYU with older compilers
// IWYU pragma: no_include <algorithm>
#include <cstddef>
#include <cstdint>
#include <vector>
Expand Down
3 changes: 2 additions & 1 deletion src/fheroes2/monster/monster_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
#ifndef H2MONSTER_INFO_H
#define H2MONSTER_INFO_H

#include <algorithm>
// TODO: this header is redundant here, but detected as required by IWYU with older compilers
// IWYU pragma: no_include <algorithm>
#include <cstdint>
#include <string>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions src/fheroes2/resource/artifact_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#include <algorithm>
#include <cassert>
#include <cstddef>
#include <memory>
Expand Down
3 changes: 2 additions & 1 deletion src/fheroes2/resource/artifact_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

#pragma once

#include <algorithm>
// TODO: this header is redundant here, but detected as required by IWYU with older compilers
// IWYU pragma: no_include <algorithm>
#include <cstdint>
#include <string>
#include <vector>
Expand Down

0 comments on commit 8769696

Please sign in to comment.