Commit 336075a42a5ae0fa322db734c481d21998e82bb8

Omar Polo 2022-06-25T09:22:02

build with -Wmissing-prototypes ok stsp@

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
diff --git a/Makefile.inc b/Makefile.inc
index 328c4a1..ef99224 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -10,7 +10,8 @@ BINDIR ?= ${PREFIX}/bin
 LIBEXECDIR ?= ${PREFIX}/libexec
 MANDIR ?= ${PREFIX}/man/man
 .else
-CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
+CFLAGS += -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS += -Wunused-variable
 PREFIX ?= ${HOME}
 BINDIR ?= ${PREFIX}/bin
 LIBEXECDIR ?= ${BINDIR}
diff --git a/got/got.c b/got/got.c
index 98f3281..79d2837 100644
--- a/got/got.c
+++ b/got/got.c
@@ -405,7 +405,7 @@ usage_import(void)
 	exit(1);
 }
 
-int
+static int
 spawn_editor(const char *editor, const char *file)
 {
 	pid_t pid;
@@ -3118,7 +3118,7 @@ struct got_update_progress_arg {
 	int verbosity;
 };
 
-void
+static void
 print_update_progress_stats(struct got_update_progress_arg *upa)
 {
 	if (!upa->did_something)
@@ -3141,7 +3141,7 @@ print_update_progress_stats(struct got_update_progress_arg *upa)
  * if the work tree was updated. This function should be used by any operation
  * which merges changes into the work tree without updating the work tree.
  */
-void
+static void
 print_merge_progress_stats(struct got_update_progress_arg *upa)
 {
 	if (!upa->did_something)
@@ -9154,7 +9154,7 @@ usage_rebase(void)
 	exit(1);
 }
 
-void
+static void
 trim_logmsg(char *logmsg, int limit)
 {
 	char *nl;
@@ -10697,7 +10697,7 @@ done:
 	return err;
 }
 
-void
+static void
 histedit_free_list(struct got_histedit_list *histedit_cmds)
 {
 	struct got_histedit_list_entry *hle;
diff --git a/gotweb/parse.y b/gotweb/parse.y
index dac1eae..9ae9b6d 100644
--- a/gotweb/parse.y
+++ b/gotweb/parse.y
@@ -70,6 +70,7 @@ struct sym {
 };
 
 int	 symset(const char *, const char *, int);
+int	 cmdline_symset(char *);
 char	*symget(const char *);
 
 const struct got_error* gerror = NULL;
diff --git a/lib/dial.c b/lib/dial.c
index 096f032..4f688a9 100644
--- a/lib/dial.c
+++ b/lib/dial.c
@@ -31,6 +31,7 @@
 #include "got_path.h"
 
 #include "got_lib_dial.h"
+#include "got_dial.h"
 
 #ifndef nitems
 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
diff --git a/lib/diff_main.c b/lib/diff_main.c
index 77f774c..dd83abd 100644
--- a/lib/diff_main.c
+++ b/lib/diff_main.c
@@ -350,7 +350,7 @@ diff_state_add_chunk(struct diff_state *state, bool solved,
 	return diff_state_add_solved_chunk(state, &chunk);
 }
 
-void
+static void
 diff_data_init_root(struct diff_data *d, FILE *f, const uint8_t *data,
     unsigned long long len, int diff_flags)
 {
@@ -501,7 +501,7 @@ diff_algo_none(const struct diff_algo_config *algo_config,
 	return DIFF_RC_OK;
 }
 
-int
+static int
 diff_run_algo(const struct diff_algo_config *algo_config,
 	      struct diff_state *state)
 {
diff --git a/lib/diff_patience.c b/lib/diff_patience.c
index abcbc8d..a06df2c 100644
--- a/lib/diff_patience.c
+++ b/lib/diff_patience.c
@@ -186,7 +186,7 @@ diff_atoms_mark_unique_in_both(struct diff_data *left, struct diff_data *right,
 
 /* Use an optimized sorting algorithm (qsort, mergesort) to find unique lines */
 
-int diff_atoms_compar(const void *_a, const void *_b)
+static int diff_atoms_compar(const void *_a, const void *_b)
 {
 	const struct diff_atom *a = *(struct diff_atom**)_a;
 	const struct diff_atom *b = *(struct diff_atom**)_b;
diff --git a/lib/fileindex.c b/lib/fileindex.c
index b05a813..52947dd 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -980,7 +980,7 @@ read_dirlist(struct got_pathlist_head *dirlist, DIR *dir, const char *path)
 	return err;
 }
 
-void
+static void
 free_dirlist(struct got_pathlist_head *dirlist)
 {
 	struct got_pathlist_entry *dle;
diff --git a/lib/gotconfig.c b/lib/gotconfig.c
index ab88498..5b602c9 100644
--- a/lib/gotconfig.c
+++ b/lib/gotconfig.c
@@ -38,6 +38,8 @@
 #include "got_lib_privsep.h"
 #include "got_lib_gotconfig.h"
 
+#include "got_gotconfig.h"
+
 const struct got_error *
 got_gotconfig_read(struct got_gotconfig **conf, const char *gotconfig_path)
 {
diff --git a/lib/object.c b/lib/object.c
index f39d1d8..7a1fbe3 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -1070,7 +1070,7 @@ request_tree(struct got_tree_object **tree, struct got_repository *repo,
 	return got_privsep_recv_tree(tree, ibuf);
 }
 
-const struct got_error *
+static const struct got_error *
 read_tree_privsep(struct got_tree_object **tree, int obj_fd,
     struct got_object_id *id, struct got_repository *repo)
 {
diff --git a/lib/object_cache.c b/lib/object_cache.c
index 644fb1a..6ed6239 100644
--- a/lib/object_cache.c
+++ b/lib/object_cache.c
@@ -83,7 +83,7 @@ got_object_cache_init(struct got_object_cache *cache,
 	return NULL;
 }
 
-size_t
+static size_t
 get_size_obj(struct got_object *obj)
 {
 	size_t size = sizeof(*obj);
@@ -101,7 +101,7 @@ get_size_obj(struct got_object *obj)
 	return size;
 }
 
-size_t
+static size_t
 get_size_tree(struct got_tree_object *tree)
 {
 	size_t size = sizeof(*tree);
@@ -110,7 +110,7 @@ get_size_tree(struct got_tree_object *tree)
 	return size;
 }
 
-size_t
+static size_t
 get_size_commit(struct got_commit_object *commit)
 {
 	size_t size = sizeof(*commit);
@@ -127,7 +127,7 @@ get_size_commit(struct got_commit_object *commit)
 	return size;
 }
 
-size_t
+static size_t
 get_size_tag(struct got_tag_object *tag)
 {
 	size_t size = sizeof(*tag);
@@ -139,7 +139,7 @@ get_size_tag(struct got_tag_object *tag)
 	return size;
 }
 
-size_t
+static size_t
 get_size_raw(struct got_raw_object *raw)
 {
 	return sizeof(*raw);
diff --git a/lib/object_create.c b/lib/object_create.c
index a3ad673..5036de1 100644
--- a/lib/object_create.c
+++ b/lib/object_create.c
@@ -43,6 +43,8 @@
 #include "got_lib_object_parse.h"
 #include "got_lib_lockfile.h"
 
+#include "got_lib_object_create.h"
+
 #ifndef nitems
 #define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
 #endif
diff --git a/lib/pack_create.c b/lib/pack_create.c
index 2e6d5f0..2b957c1 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1784,7 +1784,7 @@ done:
 	return err;
 }
 
-const struct got_error *
+static const struct got_error *
 hwrite(FILE *f, void *buf, off_t len, SHA1_CTX *ctx)
 {
 	size_t n;
@@ -1796,7 +1796,7 @@ hwrite(FILE *f, void *buf, off_t len, SHA1_CTX *ctx)
 	return NULL;
 }
 
-const struct got_error *
+static const struct got_error *
 hcopy(FILE *fsrc, FILE *fdst, off_t len, SHA1_CTX *ctx)
 {
 	unsigned char buf[65536];
@@ -1818,7 +1818,7 @@ hcopy(FILE *fsrc, FILE *fdst, off_t len, SHA1_CTX *ctx)
 	return NULL;
 }
 
-const struct got_error *
+static const struct got_error *
 hcopy_mmap(uint8_t *src, off_t src_offset, size_t src_size,
     FILE *fdst, off_t len, SHA1_CTX *ctx)
 {
diff --git a/lib/path.c b/lib/path.c
index f4b3d33..19dc9c9 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -148,12 +148,6 @@ got_path_is_root_dir(const char *path)
 }
 
 int
-got_path_is_current_dir(const char *path)
-{
-	return (path[0] == '.' && path[1] == '\0');
-}
-
-int
 got_path_is_child(const char *child, const char *parent, size_t parent_len)
 {
 	if (parent_len == 0 || got_path_is_root_dir(parent))
diff --git a/lib/pkt.c b/lib/pkt.c
index b9ef91b..a845118 100644
--- a/lib/pkt.c
+++ b/lib/pkt.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 
 #include "got_error.h"
+#include "got_lib_pkt.h"
 
 const struct got_error *
 got_pkt_readn(ssize_t *off, int fd, void *buf, size_t n)
diff --git a/lib/privsep.c b/lib/privsep.c
index ce17d48..70eb167 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -48,6 +48,8 @@
 #include "got_lib_privsep.h"
 #include "got_lib_pack.h"
 
+#include "got_privsep.h"
+
 #ifndef MIN
 #define	MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
 #endif
diff --git a/lib/worktree.c b/lib/worktree.c
index 0fefe75..ae1ce6d 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -3350,7 +3350,7 @@ status_old(void *arg, struct got_fileindex_entry *ie, const char *parent_path)
 	    ie->path, &blob_id, NULL, &commit_id, -1, NULL);
 }
 
-void
+static void
 free_ignorelist(struct got_pathlist_head *ignorelist)
 {
 	struct got_pathlist_entry *pe;
@@ -3360,7 +3360,7 @@ free_ignorelist(struct got_pathlist_head *ignorelist)
 	got_pathlist_free(ignorelist);
 }
 
-void
+static void
 free_ignores(struct got_pathlist_head *ignores)
 {
 	struct got_pathlist_entry *pe;
@@ -3429,7 +3429,7 @@ done:
 	return err;
 }
 
-int
+static int
 match_ignores(struct got_pathlist_head *ignores, const char *path)
 {
 	struct got_pathlist_entry *pe;
@@ -5596,7 +5596,7 @@ done:
 	return err;
 }
 
-const struct got_error *
+static const struct got_error *
 commit_worktree(struct got_object_id **new_commit_id,
     struct got_pathlist_head *commitable_paths,
     struct got_object_id *head_commit_id,
@@ -6637,7 +6637,7 @@ done:
 	return err;
 }
 
-const struct got_error *
+static const struct got_error *
 create_backup_ref(const char *backup_ref_prefix, struct got_reference *branch,
     struct got_object_id *new_commit_id, struct got_repository *repo)
 {
@@ -7918,7 +7918,7 @@ struct check_stage_ok_arg {
 	int have_changes;
 };
 
-const struct got_error *
+static const struct got_error *
 check_stage_ok(void *arg, unsigned char status,
     unsigned char staged_status, const char *relpath,
     struct got_object_id *blob_id, struct got_object_id *staged_blob_id,
diff --git a/libexec/got-read-gotconfig/parse.y b/libexec/got-read-gotconfig/parse.y
index 1c790b2..b9a0bd3 100644
--- a/libexec/got-read-gotconfig/parse.y
+++ b/libexec/got-read-gotconfig/parse.y
@@ -73,6 +73,7 @@ struct sym {
 };
 
 int	 symset(const char *, const char *, int);
+int	 cmdline_symset(char *);
 char	*symget(const char *);
 
 static int	 atoul(char *, u_long *);
diff --git a/regress/fetch/fetch_test.c b/regress/fetch/fetch_test.c
index 5077275..9d84105 100644
--- a/regress/fetch/fetch_test.c
+++ b/regress/fetch/fetch_test.c
@@ -45,7 +45,7 @@
 static int verbose;
 static int quiet;
 
-void
+static void
 test_printf(char *fmt, ...)
 {
 	va_list ap;
@@ -248,7 +248,7 @@ fetch_parse_uri(void)
 	if (!quiet) printf("test_%s %s\n", (name), test_ok ? "ok" : "failed"); \
 	failure = (failure || !test_ok); }
 
-void
+static void
 usage(void)
 {
 	fprintf(stderr, "usage: fetch_test [-v] [-q]\n");
diff --git a/regress/idset/idset_test.c b/regress/idset/idset_test.c
index 64c131e..920e69e 100644
--- a/regress/idset/idset_test.c
+++ b/regress/idset/idset_test.c
@@ -38,19 +38,6 @@
 static int verbose;
 static int quiet;
 
-void
-test_printf(char *fmt, ...)
-{
-	va_list ap;
-
-	if (!verbose)
-		return;
-
-	va_start(ap, fmt);
-	vprintf(fmt, ap);
-	va_end(ap);
-}
-
 static const char *id_str1 = "1111111111111111111111111111111111111111";
 static const char *id_str2 = "2222222222222222222222222222222222222222";
 static const char *id_str3 = "ffffffffffffffffffffffffffffffffffffffff";
@@ -173,7 +160,7 @@ done:
 	if (!quiet) printf("test_%s %s\n", (name), test_ok ? "ok" : "failed"); \
 	failure = (failure || !test_ok); }
 
-void
+static void
 usage(void)
 {
 	fprintf(stderr, "usage: id_test [-v] [-q]\n");
diff --git a/regress/path/path_test.c b/regress/path/path_test.c
index 76b5b1f..e8001a5 100644
--- a/regress/path/path_test.c
+++ b/regress/path/path_test.c
@@ -33,7 +33,7 @@
 static int verbose;
 static int quiet;
 
-void
+static void
 test_printf(char *fmt, ...)
 {
 	va_list ap;
@@ -211,7 +211,7 @@ path_list_reverse_input(void)
 	if (!quiet) printf("test_%s %s\n", (name), test_ok ? "ok" : "failed"); \
 	failure = (failure || !test_ok); }
 
-void
+static void
 usage(void)
 {
 	fprintf(stderr, "usage: path_test [-v] [-q]\n");
diff --git a/tog/tog.c b/tog/tog.c
index 06a2c43..130c0ad 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -224,7 +224,7 @@ free_colors(struct tog_colors *colors)
 	}
 }
 
-struct tog_color *
+static struct tog_color *
 get_color(struct tog_colors *colors, int colorpair)
 {
 	struct tog_color *tc = NULL;
@@ -1069,7 +1069,7 @@ view_input(struct tog_view **new, int *done, struct tog_view *view,
 	return err;
 }
 
-void
+static void
 view_vborder(struct tog_view *view)
 {
 	PANEL *panel;
@@ -1087,7 +1087,7 @@ view_vborder(struct tog_view *view)
 	    got_locale_is_utf8() ? ACS_VLINE : '|', view->nlines);
 }
 
-int
+static int
 view_needs_focus_indication(struct tog_view *view)
 {
 	if (view_is_parent_view(view)) {
@@ -3178,7 +3178,7 @@ match_line(const char *line, regex_t *regex, size_t nmatch,
 	return regexec(regex, line, nmatch, regmatch, 0) == 0;
 }
 
-struct tog_color *
+static struct tog_color *
 match_color(struct tog_colors *colors, const char *line)
 {
 	struct tog_color *tc = NULL;
@@ -6407,7 +6407,7 @@ ref_view_load_refs(struct tog_ref_view_state *s)
 	return NULL;
 }
 
-void
+static void
 ref_view_free_refs(struct tog_ref_view_state *s)
 {
 	struct tog_reflist_entry *re;