Unverified Commit 398412cc by Patrick Steinhardt Committed by GitHub

Merge pull request #5143 from libgit2/ethomson/warnings

ci: build with ENABLE_WERROR on Windows
parents 5c87b5a8 a3afda9f
...@@ -18,7 +18,7 @@ Write-Host "#################################################################### ...@@ -18,7 +18,7 @@ Write-Host "####################################################################
Write-Host "## Configuring build environment" Write-Host "## Configuring build environment"
Write-Host "##############################################################################" Write-Host "##############################################################################"
Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON ${Env:CMAKE_OPTIONS}" Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON -DENABLE_WERROR=ON ${Env:CMAKE_OPTIONS}"
if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) } if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) }
Write-Host "" Write-Host ""
......
...@@ -33,7 +33,7 @@ static void parse_opts(struct opts *o, int argc, char *argv[]); ...@@ -33,7 +33,7 @@ static void parse_opts(struct opts *o, int argc, char *argv[]);
int lg2_blame(git_repository *repo, int argc, char *argv[]) int lg2_blame(git_repository *repo, int argc, char *argv[])
{ {
int line, break_on_null_hunk; int line, break_on_null_hunk;
size_t i, rawsize; git_off_t i, rawsize;
char spec[1024] = {0}; char spec[1024] = {0};
struct opts o = {0}; struct opts o = {0};
const char *rawdata; const char *rawdata;
...@@ -91,7 +91,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[]) ...@@ -91,7 +91,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[])
i = 0; i = 0;
break_on_null_hunk = 0; break_on_null_hunk = 0;
while (i < rawsize) { while (i < rawsize) {
const char *eol = memchr(rawdata + i, '\n', rawsize - i); const char *eol = memchr(rawdata + i, '\n', (size_t)(rawsize - i));
char oid[10] = {0}; char oid[10] = {0};
const git_blame_hunk *hunk = git_blame_get_hunk_byline(blame, line); const git_blame_hunk *hunk = git_blame_get_hunk_byline(blame, line);
......
...@@ -17,9 +17,9 @@ static void print_progress(const progress_data *pd) ...@@ -17,9 +17,9 @@ static void print_progress(const progress_data *pd)
0; 0;
int checkout_percent = pd->total_steps > 0 int checkout_percent = pd->total_steps > 0
? (100 * pd->completed_steps) / pd->total_steps ? (int)((100 * pd->completed_steps) / pd->total_steps)
: 0; : 0;
int kbytes = pd->fetch_progress.received_bytes / 1024; size_t kbytes = pd->fetch_progress.received_bytes / 1024;
if (pd->fetch_progress.total_objects && if (pd->fetch_progress.total_objects &&
pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) { pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
...@@ -27,7 +27,7 @@ static void print_progress(const progress_data *pd) ...@@ -27,7 +27,7 @@ static void print_progress(const progress_data *pd)
pd->fetch_progress.indexed_deltas, pd->fetch_progress.indexed_deltas,
pd->fetch_progress.total_deltas); pd->fetch_progress.total_deltas);
} else { } else {
printf("net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n", printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
network_percent, kbytes, network_percent, kbytes,
pd->fetch_progress.received_objects, pd->fetch_progress.total_objects, pd->fetch_progress.received_objects, pd->fetch_progress.total_objects,
index_percent, pd->fetch_progress.indexed_objects, pd->fetch_progress.total_objects, index_percent, pd->fetch_progress.indexed_objects, pd->fetch_progress.total_objects,
......
...@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit) ...@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit)
assert(opts != NULL); assert(opts != NULL);
sz = ++opts->commit_count * sizeof(opts->commits[0]); sz = ++opts->commit_count * sizeof(opts->commits[0]);
opts->commits = xrealloc(opts->commits, sz); opts->commits = xrealloc((void *) opts->commits, sz);
opts->commits[opts->commit_count - 1] = commit; opts->commits[opts->commit_count - 1] = commit;
} }
......
...@@ -624,7 +624,7 @@ static void revwalking(git_repository *repo) ...@@ -624,7 +624,7 @@ static void revwalking(git_repository *repo)
static void index_walking(git_repository *repo) static void index_walking(git_repository *repo)
{ {
git_index *index; git_index *index;
unsigned int i, ecount; size_t i, ecount;
printf("\n*Index Walking*\n"); printf("\n*Index Walking*\n");
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# define read _read # define read _read
# define close _close # define close _close
#define ssize_t unsigned int #define ssize_t int
#else #else
# include <unistd.h> # include <unistd.h>
#endif #endif
......
...@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish) ...@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish)
assert(opts != NULL); assert(opts != NULL);
sz = ++opts->heads_count * sizeof(opts->heads[0]); sz = ++opts->heads_count * sizeof(opts->heads[0]);
opts->heads = xrealloc(opts->heads, sz); opts->heads = xrealloc((void *) opts->heads, sz);
opts->heads[opts->heads_count - 1] = refish; opts->heads[opts->heads_count - 1] = refish;
} }
...@@ -355,7 +355,7 @@ int lg2_merge(git_repository *repo, int argc, char **argv) ...@@ -355,7 +355,7 @@ int lg2_merge(git_repository *repo, int argc, char **argv)
} }
cleanup: cleanup:
free(opts.heads); free((char **)opts.heads);
free(opts.annotated); free(opts.annotated);
return 0; return 0;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
int lg2_show_index(git_repository *repo, int argc, char** argv) int lg2_show_index(git_repository *repo, int argc, char** argv)
{ {
git_index *index; git_index *index;
unsigned int i, ecount; size_t i, ecount;
char *dir = "."; char *dir = ".";
size_t dirlen; size_t dirlen;
char out[GIT_OID_HEXSZ+1]; char out[GIT_OID_HEXSZ+1];
......
...@@ -76,7 +76,7 @@ int git_win32__stack_compare( ...@@ -76,7 +76,7 @@ int git_win32__stack_compare(
} }
int git_win32__stack_format( int git_win32__stack_format(
char *pbuf, int buf_len, char *pbuf, size_t buf_len,
const git_win32__stack__raw_data *pdata, const git_win32__stack__raw_data *pdata,
const char *prefix, const char *suffix) const char *prefix, const char *suffix)
{ {
...@@ -91,10 +91,10 @@ int git_win32__stack_format( ...@@ -91,10 +91,10 @@ int git_win32__stack_format(
} s; } s;
IMAGEHLP_LINE64 line; IMAGEHLP_LINE64 line;
int buf_used = 0; size_t buf_used = 0;
unsigned int k; unsigned int k;
char detail[MY_MAX_FILENAME * 2]; /* filename plus space for function name and formatting */ char detail[MY_MAX_FILENAME * 2]; /* filename plus space for function name and formatting */
int detail_len; size_t detail_len;
if (!g_win32_stack_initialized) { if (!g_win32_stack_initialized) {
git_error_set(GIT_ERROR_INVALID, "git_win32_stack not initialized."); git_error_set(GIT_ERROR_INVALID, "git_win32_stack not initialized.");
...@@ -171,7 +171,7 @@ int git_win32__stack_format( ...@@ -171,7 +171,7 @@ int git_win32__stack_format(
} }
int git_win32__stack( int git_win32__stack(
char * pbuf, int buf_len, char * pbuf, size_t buf_len,
int skip, int skip,
const char *prefix, const char *suffix) const char *prefix, const char *suffix)
{ {
......
...@@ -38,7 +38,7 @@ typedef void (*git_win32__stack__aux_cb_alloc)(unsigned int *aux_id); ...@@ -38,7 +38,7 @@ typedef void (*git_win32__stack__aux_cb_alloc)(unsigned int *aux_id);
* @param aux_msg A buffer where a formatted message should be written. * @param aux_msg A buffer where a formatted message should be written.
* @param aux_msg_len The size of the buffer. * @param aux_msg_len The size of the buffer.
*/ */
typedef void (*git_win32__stack__aux_cb_lookup)(unsigned int aux_id, char *aux_msg, unsigned int aux_msg_len); typedef void (*git_win32__stack__aux_cb_lookup)(unsigned int aux_id, char *aux_msg, size_t aux_msg_len);
/** /**
* Register an "aux" data provider to augment our C stacktrace data. * Register an "aux" data provider to augment our C stacktrace data.
...@@ -116,7 +116,7 @@ int git_win32__stack_compare( ...@@ -116,7 +116,7 @@ int git_win32__stack_compare(
* @param suffix String written after each frame; defaults to "\n". * @param suffix String written after each frame; defaults to "\n".
*/ */
int git_win32__stack_format( int git_win32__stack_format(
char *pbuf, int buf_len, char *pbuf, size_t buf_len,
const git_win32__stack__raw_data *pdata, const git_win32__stack__raw_data *pdata,
const char *prefix, const char *suffix); const char *prefix, const char *suffix);
...@@ -132,7 +132,7 @@ int git_win32__stack_format( ...@@ -132,7 +132,7 @@ int git_win32__stack_format(
* @param suffix String written after each frame; defaults to "\n". * @param suffix String written after each frame; defaults to "\n".
*/ */
int git_win32__stack( int git_win32__stack(
char * pbuf, int buf_len, char * pbuf, size_t buf_len,
int skip, int skip,
const char *prefix, const char *suffix); const char *prefix, const char *suffix);
......
...@@ -96,7 +96,7 @@ fixture_path(const char *base, const char *fixture_name); ...@@ -96,7 +96,7 @@ fixture_path(const char *base, const char *fixture_name);
struct clar_error { struct clar_error {
const char *file; const char *file;
int line_number; size_t line_number;
const char *error_msg; const char *error_msg;
char *description; char *description;
...@@ -589,7 +589,7 @@ void clar__skip(void) ...@@ -589,7 +589,7 @@ void clar__skip(void)
void clar__fail( void clar__fail(
const char *file, const char *file,
int line, size_t line,
const char *error_msg, const char *error_msg,
const char *description, const char *description,
int should_abort) int should_abort)
...@@ -621,7 +621,7 @@ void clar__fail( ...@@ -621,7 +621,7 @@ void clar__fail(
void clar__assert( void clar__assert(
int condition, int condition,
const char *file, const char *file,
int line, size_t line,
const char *error_msg, const char *error_msg,
const char *description, const char *description,
int should_abort) int should_abort)
...@@ -634,7 +634,7 @@ void clar__assert( ...@@ -634,7 +634,7 @@ void clar__assert(
void clar__assert_equal( void clar__assert_equal(
const char *file, const char *file,
int line, size_t line,
const char *err, const char *err,
int should_abort, int should_abort,
const char *fmt, const char *fmt,
......
...@@ -141,7 +141,7 @@ void clar__skip(void); ...@@ -141,7 +141,7 @@ void clar__skip(void);
void clar__fail( void clar__fail(
const char *file, const char *file,
int line, size_t line,
const char *error, const char *error,
const char *description, const char *description,
int should_abort); int should_abort);
...@@ -149,14 +149,14 @@ void clar__fail( ...@@ -149,14 +149,14 @@ void clar__fail(
void clar__assert( void clar__assert(
int condition, int condition,
const char *file, const char *file,
int line, size_t line,
const char *error, const char *error,
const char *description, const char *description,
int should_abort); int should_abort);
void clar__assert_equal( void clar__assert_equal(
const char *file, const char *file,
int line, size_t line,
const char *err, const char *err,
int should_abort, int should_abort,
const char *fmt, const char *fmt,
......
...@@ -20,7 +20,7 @@ static void clar_print_error(int num, const struct clar_report *report, const st ...@@ -20,7 +20,7 @@ static void clar_print_error(int num, const struct clar_report *report, const st
{ {
printf(" %d) Failure:\n", num); printf(" %d) Failure:\n", num);
printf("%s::%s [%s:%d]\n", printf("%s::%s [%s:%"PRIuZ"]\n",
report->suite, report->suite,
report->test, report->test,
error->file, error->file,
......
...@@ -132,7 +132,7 @@ static void aux_cb_alloc__1(unsigned int *aux_id) ...@@ -132,7 +132,7 @@ static void aux_cb_alloc__1(unsigned int *aux_id)
*aux_id = aux_counter++; *aux_id = aux_counter++;
} }
static void aux_cb_lookup__1(unsigned int aux_id, char *aux_msg, unsigned int aux_msg_len) static void aux_cb_lookup__1(unsigned int aux_id, char *aux_msg, size_t aux_msg_len)
{ {
p_snprintf(aux_msg, aux_msg_len, "\tQQ%08x\n", aux_id); p_snprintf(aux_msg, aux_msg_len, "\tQQ%08x\n", aux_id);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment