use stricter CPPFLAGS from mpi
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
diff --git a/include/got_error.h b/include/got_error.h
index e8a9594..0d03e12 100644
--- a/include/got_error.h
+++ b/include/got_error.h
@@ -81,5 +81,5 @@ static const struct got_error {
};
const struct got_error * got_error(int code);
-const struct got_error *got_error_from_errno();
+const struct got_error *got_error_from_errno(void);
const struct got_error *got_ferror(FILE *, int);
diff --git a/lib/diff.c b/lib/diff.c
index 1a90ea1..0cc4663 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -359,9 +359,7 @@ static const struct got_error *
diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_object *tree2,
struct got_repository *repo, FILE *outfile)
{
- const struct got_error *err;
struct got_tree_entry *te2;
- char hex[SHA1_DIGEST_STRING_LENGTH];
te2 = match_entry_by_name(te1, tree2);
if (te2 == NULL) {
@@ -387,7 +385,6 @@ static const struct got_error *
diff_entry_new_old(struct got_tree_entry *te2, struct got_tree_object *tree1,
struct got_repository *repo, FILE *outfile)
{
- const struct got_error *err;
struct got_tree_entry *te1;
te1 = match_entry_by_name(te2, tree1);
diff --git a/lib/object.c b/lib/object.c
index e7ec8e7..6190d26 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -154,10 +154,9 @@ read_object_header(struct got_object **obj, struct got_repository *repo,
const struct got_error *err;
struct got_zstream_buf zb;
char *buf;
- size_t len;
const size_t zbsize = 64;
size_t outlen, totlen;
- int i, ret;
+ int i;
buf = calloc(zbsize, sizeof(char));
if (buf == NULL)
@@ -298,26 +297,6 @@ got_object_close(struct got_object *obj)
free(obj);
}
-static int
-commit_object_valid(struct got_commit_object *commit)
-{
- int i;
- int n;
-
- if (commit == NULL)
- return 0;
-
- n = 0;
- for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
- if (commit->tree_id->sha1[i] == 0)
- n++;
- }
- if (n == SHA1_DIGEST_LENGTH)
- return 0;
-
- return 1;
-}
-
static const struct got_error *
parse_commit_object(struct got_commit_object **commit, char *buf, size_t len)
{
@@ -469,7 +448,6 @@ parse_tree_entry(struct got_tree_entry **te, size_t *elen, char *buf,
{
char *p = buf, *space;
const struct got_error *err = NULL;
- char hex[SHA1_DIGEST_STRING_LENGTH];
*te = calloc(1, sizeof(**te));
if (*te == NULL)
@@ -527,7 +505,6 @@ parse_tree_object(struct got_tree_object **tree, struct got_repository *repo,
{
const struct got_error *err;
size_t remain = len;
- int nentries;
*tree = calloc(1, sizeof(**tree));
if (*tree == NULL)
@@ -612,7 +589,6 @@ read_commit_object(struct got_commit_object **commit,
const struct got_error *err = NULL;
size_t len;
uint8_t *p;
- int i, ret;
if (obj->flags & GOT_OBJ_FLAG_PACKED)
err = read_to_mem(&p, &len, f);
@@ -682,7 +658,6 @@ read_tree_object(struct got_tree_object **tree,
const struct got_error *err = NULL;
size_t len;
uint8_t *p;
- int i, ret;
if (obj->flags & GOT_OBJ_FLAG_PACKED)
err = read_to_mem(&p, &len, f);
diff --git a/lib/pack.c b/lib/pack.c
index a10bec5..1c07f63 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -302,7 +302,6 @@ get_object_idx(struct got_packidx_v2_hdr *packidx, struct got_object_id *id)
while (i < totobj) {
struct got_object_id *oid = &packidx->sorted_ids[i];
- uint32_t offset;
int cmp = got_object_id_cmp(id, oid);
if (cmp == 0)
@@ -368,7 +367,6 @@ err:
static void
cache_packidx(struct got_packidx_v2_hdr *packidx, struct got_repository *repo)
{
- struct got_packidx_v2_hdr *p;
int i;
for (i = 0; i < nitems(repo->packidx_cache); i++) {
@@ -463,9 +461,6 @@ get_packfile_path(char **path_packfile, struct got_repository *repo,
char *path_packdir;
char hex[SHA1_DIGEST_STRING_LENGTH];
char *sha1str;
- char *path_packidx;
-
- *path_packfile = NULL;
path_packdir = got_repo_get_path_objects_pack(repo);
if (path_packdir == NULL)
@@ -810,11 +805,7 @@ open_delta_object(struct got_object **obj, struct got_repository *repo,
int delta_type, size_t delta_size)
{
const struct got_error *err = NULL;
- struct got_object_id base_id;
- uint8_t base_type;
int resolved_type;
- uint64_t base_size;
- size_t base_tslen;
*obj = calloc(1, sizeof(**obj));
if (*obj == NULL)
diff --git a/lib/path.c b/lib/path.c
index 9f0d700..2359a13 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -66,7 +66,6 @@ got_path_normalize(const char *path)
const struct got_error *
got_path_segment_count(int *count, const char *path)
{
- int n = 0;
char *s = strdup(path), *p;
*count = 0;
@@ -111,7 +110,7 @@ const struct got_error *
got_opentemp_named(char **path, FILE **outfile, const char *basepath)
{
const struct got_error *err = NULL;
- int fd, ret;
+ int fd;
if (asprintf(path, "%s-XXXXXX", basepath) == -1) {
*path = NULL;
diff --git a/lib/refs.c b/lib/refs.c
index 3064e1c..4a5ef20 100644
--- a/lib/refs.c
+++ b/lib/refs.c
@@ -159,7 +159,6 @@ got_ref_open(struct got_reference **ref, struct got_repository *repo,
const struct got_error *err = NULL;
char *path_ref = NULL;
char *normpath = NULL;
- const char *parent_dir;
char *path_refs = get_refs_dir_path(repo, refname);
if (path_refs == NULL) {
@@ -202,8 +201,6 @@ struct got_reference *
got_ref_dup(struct got_reference *ref)
{
struct got_reference *ret;
- char *name = NULL;
- char *symref = NULL;
ret = calloc(1, sizeof(*ret));
if (ret == NULL)
diff --git a/lib/zbuf.c b/lib/zbuf.c
index c752076..dcdf5a7 100644
--- a/lib/zbuf.c
+++ b/lib/zbuf.c
@@ -152,7 +152,6 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outfile)
const struct got_error *err;
size_t avail;
struct got_zstream_buf zb;
- void *newbuf;
err = got_inflate_init(&zb, 8192);
if (err)
diff --git a/regress/delta/Makefile b/regress/delta/Makefile
index dd45424..0967da5 100644
--- a/regress/delta/Makefile
+++ b/regress/delta/Makefile
@@ -6,7 +6,7 @@ SRCS = delta.c error.c path.c zbuf.c delta_test.c
CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
LDADD = -lz
DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
NOMAN = yes
diff --git a/regress/repository/Makefile b/regress/repository/Makefile
index bba0a30..c54c110 100644
--- a/regress/repository/Makefile
+++ b/regress/repository/Makefile
@@ -7,7 +7,7 @@ SRCS = path.c repository.c error.c refs.c object.c sha1.c diff.c \
CPPFLAGS = -I${.CURDIR}/../../include
LDADD = -lutil -lz
DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
NOMAN = yes
diff --git a/regress/repository/repository_test.c b/regress/repository/repository_test.c
index 475cdbc..1d2959d 100644
--- a/regress/repository/repository_test.c
+++ b/regress/repository/repository_test.c
@@ -182,7 +182,6 @@ repo_read_log(const char *repo_path)
struct got_object_id *id;
struct got_object *obj;
char *buf;
- int ret;
err = got_repo_open(&repo, repo_path);
if (err != NULL || repo == NULL)
@@ -221,8 +220,6 @@ repo_read_tree(const char *repo_path)
const struct got_error *err;
struct got_repository *repo;
struct got_object *obj;
- int i;
- size_t len;
err = got_repo_open(&repo, repo_path);
if (err != NULL || repo == NULL)
@@ -292,8 +289,6 @@ repo_diff_blob(const char *repo_path)
struct got_object *obj2;
struct got_blob_object *blob1;
struct got_blob_object *blob2;
- int i;
- size_t len;
FILE *outfile;
err = got_repo_open(&repo, repo_path);
@@ -348,8 +343,6 @@ repo_diff_tree(const char *repo_path)
struct got_object *obj2;
struct got_tree_object *tree1;
struct got_tree_object *tree2;
- int i;
- size_t len;
FILE *outfile;
err = got_repo_open(&repo, repo_path);
@@ -411,7 +404,6 @@ main(int argc, char *argv[])
int test_ok = 0, failure = 0;
const char *repo_path;
int ch;
- int vflag = 0;
while ((ch = getopt(argc, argv, "v")) != -1) {
switch (ch) {
diff --git a/regress/worktree/Makefile b/regress/worktree/Makefile
index cb4b123..75af81c 100644
--- a/regress/worktree/Makefile
+++ b/regress/worktree/Makefile
@@ -7,7 +7,7 @@ SRCS = worktree.c repository.c object.c path.c error.c refs.c sha1.c pack.c \
CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
LDADD = -lutil -lz
DEBUG = -O0 -g
-CFLAGS += -Werror
+CFLAGS = -Werror -Wall -Wstrict-prototypes -Wunused-variable
NOMAN = yes