On 8/16/2016 3:34 PM, Jacek Caban wrote:
On 8/17/16 12:30 AM, David Wohlferd wrote:
Jacek? Ktietz? Where do we stand on my defines3.patch and
dxgi2.patch? Approved to push?
They are fine with me.
Thanks. Pushed.
The next warnings to clean up (unused.patch) are pretty simple. Just a
few unused params. Note that since gs_support.c only leaves the param
unused for ARM, using __UNUSED_PARAM is impractical.
A slightly trickier (to explain) is tdelete.patch. Once upon a time,
comparing NULL to pointers was a simple thing. However new C standards
get picky about comparing function pointers. Other than using #pragma
Diagnostic to ignore the warning, this is the cleanest approach I've found.
A trivial change, but it took some thought for mingw_vfscanf.patch. The
spacing suggests the decrement belongs with the 'if', but without
braces, that's not what's going to happen. I believe the intent here is
to 'not' include it with the 'if.' At the very worst, it is no more
broken after this patch than it was before.
And one more: stdio.patch. Mingw-w64 shadows a number of compiler
functions, particularly in the scanf and printf families. Since there
isn't any way to "work around" that fact, all that remains is silencing
the warnings.
Attached. Ok to push?
dw
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 9f1cfff..c37ae15 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -256,6 +256,11 @@ int fscanf(FILE *__stream, const char *__format, ...)
}
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
__mingw_ovr
__attribute__((__format__ (gnu_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
int vsscanf (const char *__source, const char *__format, __builtin_va_list __local_argv)
@@ -276,6 +281,10 @@ int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_ar
{
return __mingw_vfscanf( __stream, __format, __local_argv );
}
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
#endif /* __NO_ISOCEXT */
@@ -399,6 +408,11 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li
int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)));
#endif /*_GNU_SOURCE*/
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
__attribute__((__format__ (ms_scanf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
int __cdecl __ms_vscanf(const char * __restrict__ Format, va_list argp);
__attribute__((__format__ (ms_scanf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
@@ -426,6 +440,10 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li
return __ms_vscanf (__format, __local_argv);
}
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
#endif /* __NO_ISOCEXT */
#endif /* __USE_MINGW_ANSI_STDIO */
@@ -545,6 +563,12 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li
#if !defined (__USE_MINGW_ANSI_STDIO) || __USE_MINGW_ANSI_STDIO == 0
/* this is here to deal with software defining
* vsnprintf as _vsnprintf, eg. libxml2. */
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
#pragma push_macro("snprintf")
#pragma push_macro("vsnprintf")
# undef snprintf
@@ -578,6 +602,9 @@ int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict_
#pragma pop_macro ("vsnprintf")
#pragma pop_macro ("snprintf")
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
#endif
_CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList);
diff --git a/mingw-w64-crt/misc/tdelete.c b/mingw-w64-crt/misc/tdelete.c
index 47968a2..609681f 100644
--- a/mingw-w64-crt/misc/tdelete.c
+++ b/mingw-w64-crt/misc/tdelete.c
@@ -30,7 +30,7 @@ tdelete(const void *vkey, /* key to be deleted */
node_t *p, *q, *r;
int cmp;
- _DIAGASSERT(compar != NULL);
+ _DIAGASSERT((uintptr_t)compar != (uintptr_t)NULL);
if (rootp == NULL || (p = *rootp) == NULL)
return NULL;
diff --git a/mingw-w64-crt/crt/gs_support.c b/mingw-w64-crt/crt/gs_support.c
index f47b0fe..c5c1773 100644
--- a/mingw-w64-crt/crt/gs_support.c
+++ b/mingw-w64-crt/crt/gs_support.c
@@ -99,6 +99,7 @@ __security_init_cookie (void)
__declspec(noreturn) void __cdecl __report_gsfailure (ULONG_PTR);
+#define UNUSED_PARAM(x) { x = x; }
__declspec(noreturn) void __cdecl
__report_gsfailure (ULONG_PTR StackCookie)
{
@@ -139,6 +140,7 @@ __report_gsfailure (ULONG_PTR StackCookie)
GS_ContextRecord.Ecx = StackCookie;
#elif defined(__arm__) || defined(_ARM_)
GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Pc;
+ UNUSED_PARAM(StackCookie);
#endif /* _WIN64 */
GS_ExceptionRecord.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN;
GS_ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
diff --git a/mingw-w64-crt/misc/ftw.c b/mingw-w64-crt/misc/ftw.c
index 3482924..74d05aa 100644
--- a/mingw-w64-crt/misc/ftw.c
+++ b/mingw-w64-crt/misc/ftw.c
@@ -281,7 +281,7 @@ do_entity (ctx_t *ctx, dir_data_t *dir, const char *name, size_t namlen)
static int
-do_dir (ctx_t *ctx, struct stat *st, dir_data_t *old_dir)
+do_dir (ctx_t *ctx, struct stat *st, __UNUSED_PARAM(dir_data_t *old_dir))
{
dir_data_t dir;
struct dirent *d;
@@ -375,7 +375,7 @@ free_objs (node_t *r)
}
static int
-do_it (const char *dir, int is_nftw, void *fcb, int descriptors, int flags)
+do_it (const char *dir, __UNUSED_PARAM(int is_nftw), void *fcb, int descriptors, int flags)
{
struct ctx_t ctx;
struct stat st;
diff --git a/mingw-w64-crt/stdio/mingw_vfscanf.c b/mingw-w64-crt/stdio/mingw_vfscanf.c
index 6828caa..4bd9e91 100644
--- a/mingw-w64-crt/stdio/mingw_vfscanf.c
+++ b/mingw-w64-crt/stdio/mingw_vfscanf.c
@@ -1043,7 +1043,7 @@ __mingw_sformat (_IFP *s, const char *format, va_list argp)
if (width > 0)
width = remain;
- --wbuf_cur_sz;
+ --wbuf_cur_sz;
}
wbuf = resize_wbuf (wbuf_cur_sz, &wbuf_max_sz, wbuf);
wbuf[wbuf_cur_sz++] = c;
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public