Skip to content

Commit b1a3555

Browse files
committed
test/cfg: cleaned up includes based on include-what-you-use
1 parent 70ceb07 commit b1a3555

10 files changed

Lines changed: 44 additions & 20 deletions

File tree

test/cfg/boost.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99

1010
// cppcheck-suppress-file valueFlowBailout
1111

12-
#include <boost/config.hpp>
12+
#include <cstdio>
13+
#include <new>
14+
#include <tuple>
15+
16+
#include <boost/config.hpp> // IWYU pragma: keep
1317
#include <boost/math/special_functions/round.hpp>
14-
#include <boost/endian/conversion.hpp>
18+
#include <boost/endian/conversion.hpp> // IWYU pragma: keep
1519
#include <boost/bind/bind.hpp>
16-
#include <boost/function.hpp>
20+
#include <boost/function.hpp> // IWYU pragma: keep
1721
#include <boost/smart_ptr/scoped_array.hpp>
18-
#include <boost/thread/mutex.hpp>
22+
#include <boost/thread/mutex.hpp> // IWYU pragma: keep
1923
#include <boost/thread/lock_guard.hpp>
20-
#include <boost/test/unit_test.hpp>
24+
#include <boost/test/unit_test.hpp> // IWYU pragma: keep
2125
#include <boost/core/scoped_enum.hpp>
2226

2327
BOOST_FORCEINLINE void boost_forceinline_test()

test/cfg/cppunit.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
// cppcheck-suppress-file valueFlowBailout
1010

11+
#include <string>
12+
13+
#include <cppunit/Exception.h>
14+
#include <cppunit/Portability.h>
1115
#include <cppunit/TestAssert.h>
1216

1317
void cppunit_assert_equal(int x, double y)

test/cfg/gnu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include <stdint.h>
1717
#include <stdio.h>
1818
#include <stdarg.h>
19-
#include <netdb.h>
20-
#include <sys/time.h>
2119
#include <sys/types.h>
2220
#include <pwd.h>
2321
#include <sys/mman.h>
@@ -37,6 +35,10 @@
3735
#if !defined(__APPLE__)
3836
#include <byteswap.h>
3937
#endif
38+
#include <features.h>
39+
#include <sys/socket.h>
40+
#include <time.h>
41+
#include <stddef.h>
4042

4143
#ifdef __gnu_linux__
4244
void unreachableCode_error(void) // #11197

test/cfg/gtk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
88
//
99

10-
#include <stdlib.h>
11-
#include <gtk/gtk.h>
10+
#include <stdio.h>
1211
#include <glib.h>
12+
#include <glib/gtypes.h>
1313
#include <glib/gi18n.h>
1414

1515

test/cfg/libsigc++.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
88
//
99

10-
#include <sigc++/sigc++.h>
10+
#include <sigc++/sigc++.h> // IWYU pragma: keep
11+
#include <sigc++/functors/mem_fun.h>
12+
#include <sigc++/functors/slot.h>
13+
#include <sigc++/trackable.h>
1114

1215
struct struct1 : public sigc::trackable {
1316
void func1(int) const {}

test/cfg/openssl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
88
//
99

10-
#include <openssl/ssl.h>
1110
#include <openssl/bio.h>
11+
#include <openssl/evp.h>
12+
//#include <openssl/types.h>
13+
#include <stdio.h>
1214
#include <string.h>
1315

1416
void valid_code(BIO * bio)

test/cfg/posix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <stdarg.h>
3434
#include <ctype.h>
3535
#include <stdbool.h>
36-
#include <time.h>
3736
#include <string.h>
3837
#include <strings.h>
3938
#if defined(__APPLE__)
@@ -47,6 +46,7 @@
4746
#include <wchar.h>
4847
#include <sys/stat.h>
4948
#include <utime.h>
49+
#include <stddef.h>
5050

5151

5252
#if !defined(__APPLE__)

test/cfg/python.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define PY_SSIZE_T_CLEAN
1111
#include <Python.h> // should be the first include
1212
#include <stdio.h>
13+
#include <stdlib.h>
1314

1415
void validCode(PyObject * pPyObjArg)
1516
{

test/cfg/std.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@
2424
#define __STDC_WANT_LIB_EXT1__ 1
2525
#include <time.h>
2626
#include <stdbool.h>
27-
#include <stdint.h>
2827
#ifndef __STDC_NO_THREADS__
2928
#include <threads.h>
3029
#endif
3130
#include <inttypes.h>
3231
#include <float.h>
3332
#include <stdarg.h>
34-
#include <sys/types.h>
3533
#include <assert.h>
3634
#include <alloca.h>
3735
#include <locale.h>
3836
#include <signal.h>
37+
#include <complex.h>
38+
#include <math.h>
39+
#include <stddef.h>
3940

4041
size_t invalidFunctionArgStr_wcslen(void)
4142
{

test/cfg/std.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
// cppcheck-suppress-file valueFlowBailout
1111

12-
#include <algorithm>
12+
#include <algorithm> // IWYU pragma: keep
13+
#include <array>
1314
#include <bitset>
1415
#include <cassert>
1516
#include <cctype>
@@ -27,6 +28,7 @@
2728
#define __STDC_WANT_LIB_EXT1__ 1
2829
#include <ctime>
2930
#include <cwchar>
31+
#include <cwctype>
3032
#include <deque>
3133
#include <exception>
3234
#include <filesystem>
@@ -36,26 +38,31 @@
3638
#include <threads.h>
3739
#endif
3840
#include <iomanip>
39-
#include <ios>
41+
#include <ios> // IWYU pragma: keep
4042
#include <iostream>
41-
#include <istream>
43+
#include <istream> // IWYU pragma: keep
4244
#include <iterator>
43-
#include <list>
45+
#include <list> // IWYU pragma: keep
46+
#include <locale>
4447
#include <map>
4548
#include <memory>
4649
#include <mutex>
4750
#include <numeric>
4851
#include <queue>
4952
#include <set>
50-
#include <streambuf>
53+
#include <sstream>
54+
#include <stdexcept>
55+
#include <streambuf> // IWYU pragma: keep
56+
#include <string>
5157
#include <string_view>
58+
#include <system_error>
5259
#include <tuple>
5360
#include <unordered_map>
5461
#include <unordered_set>
5562
#include <utility>
5663
#include <variant>
5764
#include <vector>
58-
#include <version>
65+
#include <version> // IWYU pragma: keep
5966
#ifdef __cpp_lib_span
6067
#include <span>
6168
#endif

0 commit comments

Comments
 (0)