Merge branch 'squelch-warnings'

This branch suppresses or resolves compile warnings noticed in

	https://github.com/git-for-windows/git/issues/52

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2015-03-31 21:23:25 +01:00
10 changed files with 22 additions and 14 deletions

View File

@@ -355,7 +355,7 @@ GIT-VERSION-FILE: FORCE
# CFLAGS and LDFLAGS are for the users to override from the command line.
CFLAGS = -g -O2 -Wall
CFLAGS = -g -O2 -Wall -Werror
LDFLAGS =
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)

View File

@@ -8,6 +8,8 @@
#undef isatty
#define HCAST(type, handle) ((type)(intptr_t)handle)
static const int delay[] = { 0, 1, 10, 20, 40 };
unsigned int _CRT_fmode = _O_BINARY;
@@ -728,13 +730,13 @@ int pipe(int filedes[2])
errno = err_win_to_posix(GetLastError());
return -1;
}
filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
filedes[0] = _open_osfhandle(HCAST(int, h[0]), O_NOINHERIT);
if (filedes[0] < 0) {
CloseHandle(h[0]);
CloseHandle(h[1]);
return -1;
}
filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
filedes[1] = _open_osfhandle(HCAST(int, h[1]), O_NOINHERIT);
if (filedes[0] < 0) {
close(filedes[0]);
CloseHandle(h[1]);
@@ -1958,7 +1960,8 @@ void mingw_open_html(const char *unixpath)
die("cannot run browser");
printf("Launching default browser to display HTML ...\n");
r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
r = HCAST(int, ShellExecute(NULL, "open", htmlpath,
NULL, "\\", SW_SHOWNORMAL));
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r <= 32) {
@@ -2364,8 +2367,8 @@ int mingw_isatty(int fd) {
char buffer[64];
for (i = 0; i < ARRAY_SIZE(is_tty); i++) {
sprintf(buffer, " %ld ", (unsigned long)
GetStdHandle(id[i]));
sprintf(buffer, " %" PRIuMAX " ",
HCAST(uintmax_t, GetStdHandle(id[i])));
is_tty[i] = !!strstr(env, buffer);
}
}

View File

@@ -76,7 +76,7 @@
#ifdef WIN32_NATIVE
#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
#define IsConsoleHandle(h) (((long) (intptr_t) (h) & 3) == 3)
static BOOL
IsSocketHandle (HANDLE h)

View File

@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
old_tree = NULL;
if (elem->token.type == SUBEXP)
postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
static reg_errcode_t
mark_opt_subexp (void *extra, bin_tree_t *node)
{
int idx = (int) (long) extra;
int idx = (int) (intptr_t) extra;
if (node->token.type == SUBEXP && node->token.opr.idx == idx)
node->token.opt_subexp = 1;

View File

@@ -18,7 +18,10 @@
*/
#define pthread_mutex_t CRITICAL_SECTION
#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0)
static inline int return_0(int i) {
return 0;
}
#define pthread_mutex_init(a,b) return_0((InitializeCriticalSection((a)), 0))
#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
#define pthread_mutex_lock EnterCriticalSection
#define pthread_mutex_unlock LeaveCriticalSection

View File

@@ -456,7 +456,8 @@ static HANDLE duplicate_handle(HANDLE hnd)
HANDLE hresult, hproc = GetCurrentProcess();
if (!DuplicateHandle(hproc, hnd, hproc, &hresult, 0, TRUE,
DUPLICATE_SAME_ACCESS))
die_lasterr("DuplicateHandle(%li) failed", (long) hnd);
die_lasterr("DuplicateHandle(%li) failed",
(long) (intptr_t) hnd);
return hresult;
}

View File

@@ -547,6 +547,7 @@ else
BASIC_LDFLAGS += -Wl,--large-address-aware
endif
CC = gcc
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0
INSTALL = /bin/install
NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease

View File

@@ -516,7 +516,7 @@ extern int git_lstat(const char *, struct stat *);
#endif
#define DEFAULT_PACKED_GIT_LIMIT \
((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? 8192 : 256))
#ifdef NO_PREAD
#define pread git_pread

View File

@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
static int pack_revindex_ix(struct packed_git *p)
{
unsigned long ui = (unsigned long)p;
unsigned long ui = (unsigned long)(intptr_t)p;
int i;
ui = ui ^ (ui >> 16); /* defeat structure alignment */

View File

@@ -2017,7 +2017,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
{
unsigned long hash;
hash = (unsigned long)p + (unsigned long)base_offset;
hash = (unsigned long)(intptr_t)p + (unsigned long)base_offset;
hash += (hash >> 8) + (hash >> 16);
return hash % MAX_DELTA_CACHE;
}