Skip to content

Commit 043f312

Browse files
authored
Merge pull request libgit2#6113 from libgit2/ethomson/cmake3
Add missing-declarations warning globally
2 parents 7687948 + 4a6ef5a commit 043f312

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+570
-111
lines changed

cmake/DefaultCFlags.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ else()
125125
enable_warnings(documentation)
126126
disable_warnings(documentation-deprecated-sync)
127127
disable_warnings(missing-field-initializers)
128+
enable_warnings(missing-declarations)
128129
enable_warnings(strict-aliasing)
129130
enable_warnings(strict-prototypes)
130131
enable_warnings(declaration-after-statement)

examples/add.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,7 @@ int print_matched_cb(const char *path, const char *matched_pathspec, void *paylo
110110
return ret;
111111
}
112112

113-
void init_array(git_strarray *array, int argc, char **argv)
114-
{
115-
unsigned int i;
116-
117-
array->count = argc;
118-
array->strings = calloc(array->count, sizeof(char *));
119-
assert(array->strings != NULL);
120-
121-
for (i = 0; i < array->count; i++) {
122-
array->strings[i] = argv[i];
123-
}
124-
125-
return;
126-
}
127-
128-
void print_usage(void)
113+
static void print_usage(void)
129114
{
130115
fprintf(stderr, "usage: add [options] [--] file-spec [file-spec] [...]\n\n");
131116
fprintf(stderr, "\t-n, --dry-run dry run\n");

fuzzers/commit_graph_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "hash.h"
1818
#include "commit_graph.h"
1919

20+
#include "standalone_driver.h"
21+
2022
int LLVMFuzzerInitialize(int *argc, char ***argv)
2123
{
2224
GIT_UNUSED(argc);

fuzzers/config_file_fuzzer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
#include "git2.h"
1111
#include "config_backend.h"
1212

13+
#include "standalone_driver.h"
14+
1315
#define UNUSED(x) (void)(x)
1416

15-
int foreach_cb(const git_config_entry *entry, void *payload)
17+
static int foreach_cb(const git_config_entry *entry, void *payload)
1618
{
1719
UNUSED(entry);
1820
UNUSED(payload);

fuzzers/download_refs_fuzzer.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "git2/sys/transport.h"
1616
#include "futils.h"
1717

18+
#include "standalone_driver.h"
19+
1820
#define UNUSED(x) (void)(x)
1921

2022
struct fuzzer_buffer {
@@ -130,7 +132,7 @@ static int fuzzer_subtransport_new(
130132
return 0;
131133
}
132134

133-
int fuzzer_subtransport_cb(
135+
static int fuzzer_subtransport_cb(
134136
git_smart_subtransport **out,
135137
git_transport *owner,
136138
void *payload)
@@ -145,7 +147,7 @@ int fuzzer_subtransport_cb(
145147
return 0;
146148
}
147149

148-
int fuzzer_transport_cb(git_transport **out, git_remote *owner, void *param)
150+
static int fuzzer_transport_cb(git_transport **out, git_remote *owner, void *param)
149151
{
150152
git_smart_subtransport_definition def = {
151153
fuzzer_subtransport_cb,
@@ -155,7 +157,7 @@ int fuzzer_transport_cb(git_transport **out, git_remote *owner, void *param)
155157
return git_transport_smart(out, owner, &def);
156158
}
157159

158-
void fuzzer_git_abort(const char *op)
160+
static void fuzzer_git_abort(const char *op)
159161
{
160162
const git_error *err = git_error_last();
161163
fprintf(stderr, "unexpected libgit error: %s: %s\n",

fuzzers/midx_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "hash.h"
1717
#include "midx.h"
1818

19+
#include "standalone_driver.h"
20+
1921
int LLVMFuzzerInitialize(int *argc, char ***argv)
2022
{
2123
GIT_UNUSED(argc);

fuzzers/objects_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "git2.h"
1111
#include "object.h"
1212

13+
#include "standalone_driver.h"
14+
1315
#define UNUSED(x) (void)(x)
1416

1517
int LLVMFuzzerInitialize(int *argc, char ***argv)

fuzzers/packfile_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "common.h"
1515
#include "str.h"
1616

17+
#include "standalone_driver.h"
18+
1719
static git_odb *odb = NULL;
1820
static git_odb_backend *mempack = NULL;
1921

fuzzers/patch_parse_fuzzer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "patch.h"
1212
#include "patch_parse.h"
1313

14+
#include "standalone_driver.h"
15+
1416
#define UNUSED(x) (void)(x)
1517

1618
int LLVMFuzzerInitialize(int *argc, char ***argv)

fuzzers/standalone_driver.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include "futils.h"
1212
#include "path.h"
1313

14-
extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
15-
extern int LLVMFuzzerInitialize(int *argc, char ***argv);
14+
#include "standalone_driver.h"
1615

1716
static int run_one_file(const char *filename)
1817
{

0 commit comments

Comments
 (0)