From: Roland Schulz Date: Fri, 30 May 2014 05:02:23 +0000 (-0400) Subject: Used IWYU to partially clean up some includes X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=9d0e94a3fab0709b73d107b8504d60f18cc854c6;p=alexxy%2Fgromacs.git Used IWYU to partially clean up some includes - Used trunk version - Works well for C and simple C++ files - Does not yet work without manual reverting some changes for more complicated files e.g. options.cpp (see issues 105, 111, 135, and 138) - IWYU doesn't check for conditional compiled code. I ran for pme.c and wallcycle.c with -DDEBUG_PME/_WCYCLE Given that one needs to fix a few issues and have to check for #ifdefs it is still manual work, but I think quite a bit faster and more complete than doing it manually. Change-Id: I7c5569693a4b84f481f0f7afd85f0f01c33295cf --- diff --git a/admin/iwyu.imp b/admin/iwyu.imp new file mode 100644 index 0000000000..2c33b8cee4 --- /dev/null +++ b/admin/iwyu.imp @@ -0,0 +1,13 @@ +[ +{ include: ["", "private", "", "public"] }, +{ include: ["", "public", "", "public"] }, +{ include: ["", "public", "", "public"] }, +{ include: ["", "public", "", "public"] }, +{ include: ["", "public", "", "public"] }, +{ include: ["", "private", "", "public"] }, +{ include: ['"mpi.h"', "private", '"gromacs/utility/gmxmpi.h"', "public"] }, +{ include: ['"thread_mpi/atomic/gcc_x86.h"', "private", '"thread_mpi/atomic.h"', "public"] }, +{ include: ['', "public", '"gromacs/simd/simd.h"', "public"] }, +{ include: ['"gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h"', "private", '"gromacs/simd/simd.h"', "public"] }, +{ symbol: ["M_SQRT2", "private", '"gromacs/math/utilities.h"', "public"] } +] \ No newline at end of file diff --git a/admin/iwyu.sh b/admin/iwyu.sh new file mode 100755 index 0000000000..3d2fce6653 --- /dev/null +++ b/admin/iwyu.sh @@ -0,0 +1,108 @@ +#!/bin/bash +# +# This file is part of the GROMACS molecular simulation package. +# +# Copyright (c) 2014, by the GROMACS development team, led by +# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, +# and including many others, as listed in the AUTHORS file in the +# top-level source directory and at http://www.gromacs.org. +# +# GROMACS is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 +# of the License, or (at your option) any later version. +# +# GROMACS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with GROMACS; if not, see +# http://www.gnu.org/licenses, or write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If you want to redistribute modifications to GROMACS, please +# consider that scientific software is very special. Version +# control is crucial - bugs must be traceable. We will be happy to +# consider code for inclusion in the official distribution, but +# derived work must not be called official GROMACS. Details are found +# in the README & COPYING files - if they are missing, get the +# official version at http://www.gromacs.org. +# +# To help us fund GROMACS development, we humbly ask that you cite +# the research papers on the package. Check out http://www.gromacs.org. + +# The build and source folder can be specified with -B and -S respectively. +# By default it assume "-B. -S..". +# include-what-you-use needs to be in the path. Add --apply if you want +# changes to be applied. Any extra arguments are added as is to the +# command (can be used for extra defines or include paths). + +filename= +build_path=. +src_path=.. +cmd="include-what-you-use -DHAVE_CONFIG_H -mavx" + +# Read all special arguments and add others to the command +apply=0 +for arg in "$@"; do + if [ $arg == "--apply" ]; then + apply=1 + elif [[ $arg == -[SB] ]]; then + echo -S and -B require an argument + exit 1 + elif [[ $arg == -B* ]]; then + build_path=${arg:2} + elif [[ $arg == -S* ]]; then + src_path=${arg:2} + elif [[ $arg != -* ]]; then + if [ "$filename" == "" ]; then + filename=$arg + else + echo "This script can only be run on one file at a time" + exit 1 + fi + else + cmd="$cmd $arg" + fi +done + +if [ "$filename" == "" ]; then + echo "No file specified" + exit 1 +fi + +# We cannot detect wether it is a C++ or C header. Should be fine to always use C++ +if [ "${filename##*.}" == "h" ]; then + cmd="$cmd -x c++" +fi + +cmd="$cmd $filename" + +# Always use C++11. +if [ "${filename##*.}" == "cpp" -o "${filename##*.}" == "h" ]; then + cmd="$cmd -std=c++11" +fi + +# keep gmxpre.h for source files +if [ "${filename##*.}" == "cpp" -o "${filename##*.}" == "c" ]; then + cmd="$cmd -Xiwyu --pch_in_code -Xiwyu --prefix_header_includes=keep" +fi + +if [ $src_path == "." ]; then + src_folder="src" # ./src confuses IWYU +else + src_folder="$src_path/src" +fi + +cmd="$cmd -I${src_folder} -I${src_folder}/external/thread_mpi/include + -I$build_path/src -I${src_folder}/external/boost + -Xiwyu --mapping_file=${src_path}/admin/iwyu.imp" + +if [ $apply -eq 1 ] ; then + cmd="$cmd 2>&1 | fix_includes.py --nosafe_headers || + ${src_path}/docs/doxygen/includesorter.py $filename -B$build_path -S$src_path" +fi + +eval $cmd diff --git a/src/gromacs/ewald/pme.c b/src/gromacs/ewald/pme.c index 76344ea75e..14a5c97135 100644 --- a/src/gromacs/ewald/pme.c +++ b/src/gromacs/ewald/pme.c @@ -67,31 +67,40 @@ #include #include #include -#include #include "gromacs/ewald/pme-internal.h" +#include "gromacs/fft/fft.h" #include "gromacs/fft/parallel_3dfft.h" -#include "gromacs/fileio/pdbio.h" #include "gromacs/legacyheaders/macros.h" -#include "gromacs/legacyheaders/network.h" #include "gromacs/legacyheaders/nrnb.h" -#include "gromacs/legacyheaders/txtdump.h" -#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/legacyheaders/types/commrec.h" +#include "gromacs/legacyheaders/types/enums.h" +#include "gromacs/legacyheaders/types/forcerec.h" +#include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/nrnb.h" #include "gromacs/math/gmxcomplex.h" #include "gromacs/math/units.h" #include "gromacs/math/vec.h" +#include "gromacs/math/vectypes.h" +/* Include the SIMD macro file and then check for support */ +#include "gromacs/simd/simd.h" +#include "gromacs/simd/simd_math.h" #include "gromacs/timing/cyclecounter.h" #include "gromacs/timing/wallcycle.h" +#include "gromacs/timing/walltime_accounting.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/fatalerror.h" -#include "gromacs/utility/futil.h" #include "gromacs/utility/gmxmpi.h" #include "gromacs/utility/gmxomp.h" +#include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" -/* Include the SIMD macro file and then check for support */ -#include "gromacs/simd/simd.h" -#include "gromacs/simd/simd_math.h" +#ifdef DEBUG_PME +#include "gromacs/fileio/pdbio.h" +#include "gromacs/utility/cstringutil.h" +#include "gromacs/utility/futil.h" +#endif + #ifdef GMX_SIMD_HAVE_REAL /* Turn on arbitrary width SIMD intrinsics for PME solve */ # define PME_SIMD_SOLVE @@ -1438,7 +1447,7 @@ static void spread_coefficients_bsplines_thread(pmegrid_t *pm #define PME_SPREAD_SIMD4_ALIGNED #define PME_ORDER 4 #endif -#include "gromacs/ewald/pme-simd4.h" +#include "gromacs/ewald/pme-simd4.h" /* IWYU pragma: keep */ #else DO_BSPLINE(4); #endif @@ -1447,7 +1456,7 @@ static void spread_coefficients_bsplines_thread(pmegrid_t *pm #ifdef PME_SIMD4_SPREAD_GATHER #define PME_SPREAD_SIMD4_ALIGNED #define PME_ORDER 5 -#include "gromacs/ewald/pme-simd4.h" +#include "gromacs/ewald/pme-simd4.h" /* IWYU pragma: keep */ #else DO_BSPLINE(5); #endif @@ -2601,7 +2610,7 @@ static void gather_f_bsplines(gmx_pme_t pme, real *grid, #define PME_GATHER_F_SIMD4_ALIGNED #define PME_ORDER 4 #endif -#include "gromacs/ewald/pme-simd4.h" +#include "gromacs/ewald/pme-simd4.h" /* IWYU pragma: keep */ #else DO_FSPLINE(4); #endif @@ -2610,7 +2619,7 @@ static void gather_f_bsplines(gmx_pme_t pme, real *grid, #ifdef PME_SIMD4_SPREAD_GATHER #define PME_GATHER_F_SIMD4_ALIGNED #define PME_ORDER 5 -#include "gromacs/ewald/pme-simd4.h" +#include "gromacs/ewald/pme-simd4.h" /* IWYU pragma: keep */ #else DO_FSPLINE(5); #endif diff --git a/src/gromacs/ewald/pme.h b/src/gromacs/ewald/pme.h index f22341e102..708626b36b 100644 --- a/src/gromacs/ewald/pme.h +++ b/src/gromacs/ewald/pme.h @@ -40,11 +40,16 @@ #include -#include "gromacs/legacyheaders/network.h" -#include "gromacs/legacyheaders/typedefs.h" -#include "gromacs/math/gmxcomplex.h" +#include "gromacs/legacyheaders/types/commrec_fwd.h" +#include "gromacs/legacyheaders/types/forcerec.h" +#include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/interaction_const.h" +#include "gromacs/legacyheaders/types/nrnb.h" +#include "gromacs/math/vectypes.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/timing/walltime_accounting.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/domdec.h b/src/gromacs/legacyheaders/domdec.h index c44c7bf840..d8b9e6373f 100644 --- a/src/gromacs/legacyheaders/domdec.h +++ b/src/gromacs/legacyheaders/domdec.h @@ -36,10 +36,25 @@ #ifndef _domdec_h #define _domdec_h -#include "gromacs/legacyheaders/genborn.h" -#include "gromacs/legacyheaders/typedefs.h" +#include + #include "gromacs/legacyheaders/vsite.h" +#include "gromacs/legacyheaders/types/commrec_fwd.h" +#include "gromacs/legacyheaders/types/constr.h" +#include "gromacs/legacyheaders/types/forcerec.h" +#include "gromacs/legacyheaders/types/hw_info.h" +#include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/mdatom.h" +#include "gromacs/legacyheaders/types/nrnb.h" +#include "gromacs/legacyheaders/types/shellfc.h" +#include "gromacs/legacyheaders/types/state.h" +#include "gromacs/math/vectypes.h" #include "gromacs/timing/wallcycle.h" +#include "gromacs/topology/block.h" +#include "gromacs/topology/idef.h" +#include "gromacs/topology/topology.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/types/commrec.h b/src/gromacs/legacyheaders/types/commrec.h index 4486c847b6..cfc7669a2f 100644 --- a/src/gromacs/legacyheaders/types/commrec.h +++ b/src/gromacs/legacyheaders/types/commrec.h @@ -37,8 +37,13 @@ #ifndef _commrec_h #define _commrec_h -#include "gromacs/legacyheaders/typedefs.h" +#include + +#include "gromacs/legacyheaders/types/commrec_fwd.h" // IWYU pragma: export +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/gmxmpi.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { @@ -268,12 +273,12 @@ struct t_commrec { gmx_nodecomm_t nc; /* For domain decomposition */ - gmx_domdec_t *dd; + struct gmx_domdec_t *dd; /* The duties of this node, see the defines above */ - int duty; + int duty; - gmx_multisim_t *ms; + struct gmx_multisim_t *ms; /* these buffers are used as destination buffers if MPI_IN_PLACE isn't supported.*/ diff --git a/src/gromacs/legacyheaders/types/fcdata.h b/src/gromacs/legacyheaders/types/fcdata.h index 9188a3bb6e..8e5498129f 100644 --- a/src/gromacs/legacyheaders/types/fcdata.h +++ b/src/gromacs/legacyheaders/types/fcdata.h @@ -42,6 +42,8 @@ extern "C" { #endif #include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" typedef real rvec5[5]; diff --git a/src/gromacs/legacyheaders/types/forcerec.h b/src/gromacs/legacyheaders/types/forcerec.h index f3f1302d59..151c68af6d 100644 --- a/src/gromacs/legacyheaders/types/forcerec.h +++ b/src/gromacs/legacyheaders/types/forcerec.h @@ -42,9 +42,13 @@ #include "gromacs/legacyheaders/types/genborn.h" #include "gromacs/legacyheaders/types/hw_info.h" #include "gromacs/legacyheaders/types/interaction_const.h" +#include "gromacs/legacyheaders/types/nblist.h" #include "gromacs/legacyheaders/types/ns.h" #include "gromacs/legacyheaders/types/qmmmrec.h" +#include "gromacs/math/vectypes.h" #include "gromacs/topology/idef.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/types/genborn.h b/src/gromacs/legacyheaders/types/genborn.h index d7acafe011..cfc9b4709e 100644 --- a/src/gromacs/legacyheaders/types/genborn.h +++ b/src/gromacs/legacyheaders/types/genborn.h @@ -38,12 +38,13 @@ #ifndef GMX_LEGACYHEADERS_TYPES_GENBORN_H #define GMX_LEGACYHEADERS_TYPES_GENBORN_H +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/real.h" + #ifdef __cplusplus extern "C" { #endif -#include "gromacs/legacyheaders/types/simple.h" - typedef struct { int nbonds; diff --git a/src/gromacs/legacyheaders/types/group.h b/src/gromacs/legacyheaders/types/group.h index ea2fd293c7..1ad37bad7f 100644 --- a/src/gromacs/legacyheaders/types/group.h +++ b/src/gromacs/legacyheaders/types/group.h @@ -37,7 +37,9 @@ #ifndef GMX_LEGACYHEADERS_TYPES_GROUP_H #define GMX_LEGACYHEADERS_TYPES_GROUP_H -#include "gromacs/legacyheaders/types/simple.h" +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/math/do_fit.c b/src/gromacs/math/do_fit.c index 95d4b03fb6..ff2f71fa86 100644 --- a/src/gromacs/math/do_fit.c +++ b/src/gromacs/math/do_fit.c @@ -38,6 +38,9 @@ #include "do_fit.h" +#include +#include + #include "gromacs/linearalgebra/nrjac.h" #include "gromacs/math/utilities.h" #include "gromacs/math/vec.h" diff --git a/src/gromacs/math/do_fit.h b/src/gromacs/math/do_fit.h index 7ccb652f19..526d4e3313 100644 --- a/src/gromacs/math/do_fit.h +++ b/src/gromacs/math/do_fit.h @@ -39,6 +39,7 @@ #include "gromacs/legacyheaders/types/simple.h" #include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/real.h" #ifdef __cplusplus diff --git a/src/gromacs/mdlib/domdec.cpp b/src/gromacs/mdlib/domdec.cpp index e3a05a5dd5..c1b2594bfd 100644 --- a/src/gromacs/mdlib/domdec.cpp +++ b/src/gromacs/mdlib/domdec.cpp @@ -40,11 +40,11 @@ #include "config.h" #include +#include #include #include #include #include -#include #include @@ -57,10 +57,10 @@ #include "gromacs/legacyheaders/constr.h" #include "gromacs/legacyheaders/domdec_network.h" #include "gromacs/legacyheaders/force.h" +#include "gromacs/legacyheaders/genborn.h" #include "gromacs/legacyheaders/gmx_ga2la.h" #include "gromacs/legacyheaders/gmx_omp_nthreads.h" #include "gromacs/legacyheaders/gpu_utils.h" -#include "gromacs/legacyheaders/macros.h" #include "gromacs/legacyheaders/mdatoms.h" #include "gromacs/legacyheaders/mdrun.h" #include "gromacs/legacyheaders/names.h" @@ -69,8 +69,23 @@ #include "gromacs/legacyheaders/nsgrid.h" #include "gromacs/legacyheaders/shellfc.h" #include "gromacs/legacyheaders/typedefs.h" -#include "gromacs/listed-forces/bonded.h" +#include "gromacs/legacyheaders/vsite.h" +#include "gromacs/legacyheaders/types/commrec.h" +#include "gromacs/legacyheaders/types/constr.h" +#include "gromacs/legacyheaders/types/enums.h" +#include "gromacs/legacyheaders/types/forcerec.h" +#include "gromacs/legacyheaders/types/hw_info.h" +#include "gromacs/legacyheaders/types/ifunc.h" +#include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/mdatom.h" +#include "gromacs/legacyheaders/types/nrnb.h" +#include "gromacs/legacyheaders/types/ns.h" +#include "gromacs/legacyheaders/types/nsgrid.h" +#include "gromacs/legacyheaders/types/shellfc.h" +#include "gromacs/legacyheaders/types/simple.h" +#include "gromacs/legacyheaders/types/state.h" #include "gromacs/math/vec.h" +#include "gromacs/math/vectypes.h" #include "gromacs/mdlib/nb_verlet.h" #include "gromacs/mdlib/nbnxn_search.h" #include "gromacs/pbcutil/ishift.h" @@ -79,12 +94,17 @@ #include "gromacs/pulling/pull_rotation.h" #include "gromacs/swap/swapcoords.h" #include "gromacs/timing/wallcycle.h" +#include "gromacs/topology/block.h" +#include "gromacs/topology/idef.h" #include "gromacs/topology/mtop_util.h" +#include "gromacs/topology/topology.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/basenetwork.h" +#include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" -#include "gromacs/utility/futil.h" #include "gromacs/utility/gmxmpi.h" #include "gromacs/utility/qsort_threadsafe.h" +#include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" #define DDRANK(dd, rank) (rank) diff --git a/src/gromacs/mdlib/nbnxn_pairlist.h b/src/gromacs/mdlib/nbnxn_pairlist.h index 3f441ad16c..413af35801 100644 --- a/src/gromacs/mdlib/nbnxn_pairlist.h +++ b/src/gromacs/mdlib/nbnxn_pairlist.h @@ -36,9 +36,14 @@ #ifndef _nbnxn_pairlist_h #define _nbnxn_pairlist_h +#include + #include "thread_mpi/atomic.h" #include "gromacs/legacyheaders/types/nblist.h" +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h b/src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h index 999b417d68..493fe2a34f 100644 --- a/src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h +++ b/src/gromacs/simd/impl_x86_avx_256/impl_x86_avx_256.h @@ -38,8 +38,6 @@ #include "config.h" -#include - #include /* It is cleaner to start the AVX implementation from scratch rather than diff --git a/src/gromacs/timing/wallcycle.c b/src/gromacs/timing/wallcycle.c index 3b0d906636..95741a661e 100644 --- a/src/gromacs/timing/wallcycle.c +++ b/src/gromacs/timing/wallcycle.c @@ -41,13 +41,11 @@ #include "config.h" #include -#include #include "gromacs/legacyheaders/md_logging.h" #include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/timing/cyclecounter.h" #include "gromacs/utility/cstringutil.h" -#include "gromacs/utility/fatalerror.h" #include "gromacs/utility/gmxmpi.h" #include "gromacs/utility/smalloc.h" @@ -57,6 +55,10 @@ */ /* #define DEBUG_WCYCLE */ +#ifdef DEBUG_WCYCLE +#include "gromacs/utility/fatalerror.h" +#endif + typedef struct { int n; diff --git a/src/gromacs/topology/atomprop.cpp b/src/gromacs/topology/atomprop.cpp index a2fdfece3e..0c237a1220 100644 --- a/src/gromacs/topology/atomprop.cpp +++ b/src/gromacs/topology/atomprop.cpp @@ -39,6 +39,7 @@ #include "atomprop.h" #include +#include #include #include "gromacs/fileio/strdb.h" diff --git a/src/gromacs/topology/mtop_util.c b/src/gromacs/topology/mtop_util.c index b069c64419..19fd0927dc 100644 --- a/src/gromacs/topology/mtop_util.c +++ b/src/gromacs/topology/mtop_util.c @@ -36,16 +36,24 @@ #include "mtop_util.h" +#include +#include +#include #include #include +#include "gromacs/legacyheaders/types/enums.h" #include "gromacs/legacyheaders/types/ifunc.h" #include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/simple.h" +#include "gromacs/math/vectypes.h" +#include "gromacs/topology/atoms.h" #include "gromacs/topology/block.h" -#include "gromacs/topology/symtab.h" +#include "gromacs/topology/idef.h" #include "gromacs/topology/topology.h" #include "gromacs/topology/topsort.h" #include "gromacs/utility/fatalerror.h" +#include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" static int gmx_mtop_maxresnr(const gmx_mtop_t *mtop, int maxres_renum) diff --git a/src/gromacs/utility/basedefinitions.h b/src/gromacs/utility/basedefinitions.h index 10ed2c7f6d..9c7e583d25 100644 --- a/src/gromacs/utility/basedefinitions.h +++ b/src/gromacs/utility/basedefinitions.h @@ -44,8 +44,6 @@ #ifndef GMX_UTILITY_BASEDEFINITIONS_H #define GMX_UTILITY_BASEDEFINITIONS_H -/* Information about integer data type sizes */ -#include #include #ifndef _MSC_VER #include diff --git a/src/gromacs/utility/basenetwork.cpp b/src/gromacs/utility/basenetwork.cpp index 64ef078feb..c3a90db5d1 100644 --- a/src/gromacs/utility/basenetwork.cpp +++ b/src/gromacs/utility/basenetwork.cpp @@ -40,12 +40,11 @@ #include "config.h" -#include +#include #include #include #include -#include #include #ifdef HAVE_UNISTD_H diff --git a/src/gromacs/utility/fatalerror.cpp b/src/gromacs/utility/fatalerror.cpp index f242e2d448..ac6593aad5 100644 --- a/src/gromacs/utility/fatalerror.cpp +++ b/src/gromacs/utility/fatalerror.cpp @@ -41,7 +41,7 @@ #include "config.h" #include -#include +#include #include #include @@ -49,14 +49,17 @@ #include "thread_mpi/threads.h" -#include "gromacs/utility/basenetwork.h" #include "gromacs/utility/baseversion.h" -#include "gromacs/utility/common.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/futil.h" -#include "gromacs/utility/gmxmpi.h" #include "gromacs/utility/programcontext.h" -#include "gromacs/utility/smalloc.h" + +#ifdef GMX_MPI +#include "gromacs/utility/basenetwork.h" +#include "gromacs/utility/gmxmpi.h" +#else +#include "gromacs/utility/common.h" +#endif static bool bDebug = false; static tMPI_Thread_mutex_t where_mutex = TMPI_THREAD_MUTEX_INITIALIZER; diff --git a/src/gromacs/utility/gmxmpi.h b/src/gromacs/utility/gmxmpi.h index cacc0a0cbe..aef668910f 100644 --- a/src/gromacs/utility/gmxmpi.h +++ b/src/gromacs/utility/gmxmpi.h @@ -73,8 +73,8 @@ #endif /*MPI_INT64_T*/ #else #ifdef GMX_THREAD_MPI -#include "thread_mpi/mpi_bindings.h" -#include "thread_mpi/tmpi.h" +#include "thread_mpi/mpi_bindings.h" /* IWYU pragma: export */ +#include "thread_mpi/tmpi.h" /* IWYU pragma: export */ #else typedef void* MPI_Comm; typedef void* MPI_Request; diff --git a/src/gromacs/utility/uniqueptr.h b/src/gromacs/utility/uniqueptr.h index 93d376cd8a..330f04b538 100644 --- a/src/gromacs/utility/uniqueptr.h +++ b/src/gromacs/utility/uniqueptr.h @@ -46,10 +46,10 @@ #include "config.h" -#ifdef GMX_CXX11 // C++11 Compiler -#include -#include -#else // C++03 Compiler +#ifdef GMX_CXX11 // C++11 Compiler +#include // IWYU pragma: export +#include // IWYU pragma: export +#else // C++03 Compiler #include #endif diff --git a/src/programs/mdrun/deform.h b/src/programs/mdrun/deform.h index d2106f1cb1..2cc61dcd3d 100644 --- a/src/programs/mdrun/deform.h +++ b/src/programs/mdrun/deform.h @@ -38,6 +38,9 @@ #include "thread_mpi/threads.h" +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/basedefinitions.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/programs/mdrun/md.cpp b/src/programs/mdrun/md.cpp index 3b5ab113af..e0d6fdeffa 100644 --- a/src/programs/mdrun/md.cpp +++ b/src/programs/mdrun/md.cpp @@ -38,47 +38,64 @@ #include "config.h" +#include +#include #include +#include "thread_mpi/threads.h" + #include "gromacs/ewald/pme-load-balancing.h" #include "gromacs/ewald/pme.h" -#include "gromacs/fileio/confio.h" +#include "gromacs/fileio/filenm.h" #include "gromacs/fileio/mdoutf.h" #include "gromacs/fileio/trajectory_writing.h" -#include "gromacs/fileio/trnio.h" +#include "gromacs/fileio/trx.h" #include "gromacs/fileio/trxio.h" -#include "gromacs/fileio/xtcio.h" #include "gromacs/gmxpreprocess/compute_io.h" #include "gromacs/imd/imd.h" #include "gromacs/legacyheaders/bonded-threading.h" -#include "gromacs/legacyheaders/calcmu.h" -#include "gromacs/legacyheaders/checkpoint.h" #include "gromacs/legacyheaders/constr.h" -#include "gromacs/legacyheaders/disre.h" #include "gromacs/legacyheaders/domdec.h" #include "gromacs/legacyheaders/domdec_network.h" +#include "gromacs/legacyheaders/ebin.h" #include "gromacs/legacyheaders/force.h" #include "gromacs/legacyheaders/md_logging.h" #include "gromacs/legacyheaders/md_support.h" #include "gromacs/legacyheaders/mdatoms.h" #include "gromacs/legacyheaders/mdebin.h" #include "gromacs/legacyheaders/mdrun.h" -#include "gromacs/legacyheaders/names.h" #include "gromacs/legacyheaders/network.h" #include "gromacs/legacyheaders/nrnb.h" #include "gromacs/legacyheaders/ns.h" -#include "gromacs/legacyheaders/orires.h" -#include "gromacs/legacyheaders/qmmm.h" #include "gromacs/legacyheaders/shellfc.h" #include "gromacs/legacyheaders/sighandler.h" -#include "gromacs/legacyheaders/txtdump.h" +#include "gromacs/legacyheaders/sim_util.h" +#include "gromacs/legacyheaders/tgroup.h" #include "gromacs/legacyheaders/typedefs.h" #include "gromacs/legacyheaders/update.h" #include "gromacs/legacyheaders/vcm.h" #include "gromacs/legacyheaders/vsite.h" +#include "gromacs/legacyheaders/types/commrec.h" +#include "gromacs/legacyheaders/types/constr.h" +#include "gromacs/legacyheaders/types/enums.h" +#include "gromacs/legacyheaders/types/fcdata.h" +#include "gromacs/legacyheaders/types/force_flags.h" +#include "gromacs/legacyheaders/types/forcerec.h" +#include "gromacs/legacyheaders/types/globsig.h" +#include "gromacs/legacyheaders/types/group.h" +#include "gromacs/legacyheaders/types/inputrec.h" +#include "gromacs/legacyheaders/types/interaction_const.h" #include "gromacs/legacyheaders/types/iteratedconstraints.h" +#include "gromacs/legacyheaders/types/mdatom.h" +#include "gromacs/legacyheaders/types/membedt.h" #include "gromacs/legacyheaders/types/nlistheuristics.h" +#include "gromacs/legacyheaders/types/nrnb.h" +#include "gromacs/legacyheaders/types/oenv.h" +#include "gromacs/legacyheaders/types/shellfc.h" +#include "gromacs/legacyheaders/types/state.h" +#include "gromacs/math/utilities.h" #include "gromacs/math/vec.h" +#include "gromacs/math/vectypes.h" #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.h" #include "gromacs/pbcutil/mshift.h" #include "gromacs/pbcutil/pbc.h" @@ -86,9 +103,14 @@ #include "gromacs/swap/swapcoords.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/timing/walltime_accounting.h" +#include "gromacs/topology/atoms.h" +#include "gromacs/topology/idef.h" #include "gromacs/topology/mtop_util.h" +#include "gromacs/topology/topology.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/cstringutil.h" -#include "gromacs/utility/gmxmpi.h" +#include "gromacs/utility/fatalerror.h" +#include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" #include "deform.h"