Skip to content

Commit 49f3627

Browse files
committedJul 25, 2021
[fix] Fix includes according to iwyu
* All files that change in this commit are working after the changes suggested from iwyu. * For shellout.{c,h} and svsem.c changes to headers are not possible since the headers suggested by iwyu are private and would break the build of the library.
1 parent 85d5a63 commit 49f3627

15 files changed

+20
-14
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.ccls-cache/
22
build
3+
.cache
4+
compile_commands.json

‎include/mba/cfg.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern "C" {
2525
#include <mba/allocator.h>
2626
#include <mba/linkedlist.h>
2727
#include <mba/text.h>
28+
struct allocator;
2829

2930
struct cfg {
3031
struct linkedlist list;

‎include/mba/csv.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#endif /* WIN32 */
2121
#endif /* LIBMBA_API */
2222

23+
#include <stddef.h>
2324
#include <stdio.h>
2425
#include <mba/text.h>
2526

‎include/mba/daemon.h

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <stdio.h>
55
#include <sys/types.h>
6-
#include <sys/stat.h>
76

87
extern FILE *logfp;
98

‎include/mba/diff.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern "C" {
2222

2323
#include <mba/varray.h>
2424
#include <mba/hashmap.h> /* cmp_fn */
25+
struct varray;
2526

2627
typedef const void *(*idx_fn)(const void *s, int idx, void *context);
2728

‎include/mba/hashmap.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern "C" {
2222

2323
#include <mba/iterator.h>
2424
#include <mba/allocator.h>
25+
#include <stddef.h>
2526

2627
#if USE_WCHAR
2728
#define hash_text hash_wcs
@@ -36,8 +37,6 @@ typedef int (*cmp_fn)(const void *object1, const void *object2, void *context);
3637

3738
extern const int table_sizes[];
3839

39-
struct entry;
40-
4140
struct hashmap {
4241
int table_size_index;
4342
ref_t hash;

‎include/mba/misc.h

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ extern "C" {
77

88
#ifndef _WIN32
99

10+
#include <stddef.h>
1011
#include <sys/types.h>
1112

1213
int copen(const char *pathname, int flags, mode_t mode, int *cre);

‎include/mba/shellout.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
extern "C" {
99
#endif
1010

11-
#include <sys/types.h>
1211
#include <termios.h>
12+
#include <sys/types.h>
13+
#include <stddef.h>
1314

1415
#define SHO_FLAGS_INTERACT 0x0001
1516
#define SHO_FLAGS_ISATTY 0x0100

‎include/mba/svcond.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ extern "C" {
1010
#endif
1111

1212
#include <mba/svsem.h>
13-
#include <mba/pool.h>
13+
struct allocator;
14+
struct pool;
1415

1516
typedef struct {
1617
struct pool *sempool;

‎include/mba/svsem.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
extern "C" {
99
#endif
1010

11-
#include <sys/types.h>
12-
#include <sys/sem.h> /* for SEM_UNDO */
13-
#include <fcntl.h>
14-
#include <mba/pool.h>
1511
#include <mba/varray.h>
12+
struct pool;
1613

1714
#define O_UNDO 0x80000
1815

‎include/mba/text.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ LIBMBA_API int _fputws(const wchar_t *buf, FILE *stream);
170170

171171
#else
172172

173-
#include <string.h>
173+
#include <stddef.h>
174174
#include <ctype.h>
175+
struct allocator;
175176

176177
#define TEOF EOF
177178
typedef int tint_t;

‎src/cfg.c

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include <mba/cfg.h>
3838
#include <mba/text.h>
3939

40+
#include <bits/types/mbstate_t.h>
41+
4042
#if USE_WCHAR
4143

4244
#define T1PMNF(m,s) PMNF((m), ": %ls", (s))

‎src/csv.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
* OTHER DEALINGS IN THE SOFTWARE.
2323
*/
2424

25-
#include <stdlib.h>
2625
#include <string.h>
2726
#include <stdio.h>
27+
#include <stddef.h>
2828
#include <ctype.h>
2929
#include <errno.h>
30-
#include <wchar.h>
3130
#include <wctype.h>
3231

3332
#include <mba/msgno.h>
3433
#include <mba/csv.h>
34+
#include <bits/types/wint_t.h>
3535

3636
#define ST_START 1
3737
#define ST_COLLECT 2

‎src/hashmap.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
#include <stddef.h>
2525
#include <string.h>
2626
#include <errno.h>
27-
#include <wchar.h>
2827

2928
#include <mba/msgno.h>
3029
#include <mba/iterator.h>
3130
#include <mba/allocator.h>
3231
#include <mba/hashmap.h>
33-
32+
#include <bits/types/wint_t.h>
3433

3534
#define HAL(h) ((struct allocator *)((h)->al ? (char *)(h) - (ptrdiff_t)(h)->al : NULL))
3635

‎src/text.c

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* OTHER DEALINGS IN THE SOFTWARE.
2323
*/
2424

25+
#include <bits/types/mbstate_t.h>
2526
#include <stdlib.h>
2627
#include <stdio.h>
2728
#include <stddef.h>

0 commit comments

Comments
 (0)