libbacktrace: always pass -g when compiling test code

This approach required adding a few casts to ztest.c, as it is now
compiled with -Wall.

Fixes GCC PR libbacktrace/90636
This commit is contained in:
Ian Lance Taylor
2020-02-18 18:49:42 -08:00
parent bd02146d90
commit 929d6205cf
3 changed files with 305 additions and 64 deletions

18
ztest.c
View File

@@ -89,7 +89,8 @@ struct zlib_test
/* Error callback. */
static void
error_callback_compress (void *vdata, const char *msg, int errnum)
error_callback_compress (void *vdata ATTRIBUTE_UNUSED, const char *msg,
int errnum)
{
fprintf (stderr, "%s", msg);
if (errnum > 0)
@@ -360,7 +361,7 @@ test_large (struct backtrace_state *state)
fclose (e);
if (got > 0)
{
orig_buf = rbuf;
orig_buf = (unsigned char *) rbuf;
orig_bufsize = got;
break;
}
@@ -383,7 +384,7 @@ test_large (struct backtrace_state *state)
}
compress_sizearg = compressed_bufsize - 12;
r = compress (compressed_buf + 12, &compress_sizearg,
r = compress ((unsigned char *) compressed_buf + 12, &compress_sizearg,
orig_buf, orig_bufsize);
if (r != Z_OK)
{
@@ -406,7 +407,8 @@ test_large (struct backtrace_state *state)
}
uncompressed_bufsize = orig_bufsize;
if (!backtrace_uncompress_zdebug (state, compressed_buf, compressed_bufsize,
if (!backtrace_uncompress_zdebug (state, (unsigned char *) compressed_buf,
compressed_bufsize,
error_callback_compress, NULL,
&uncompressed_buf, &uncompressed_bufsize))
{
@@ -443,7 +445,8 @@ test_large (struct backtrace_state *state)
return;
}
if (!backtrace_uncompress_zdebug (state, compressed_buf,
if (!backtrace_uncompress_zdebug (state,
(unsigned char *) compressed_buf,
compressed_bufsize,
error_callback_compress, NULL,
&uncompressed_buf,
@@ -472,8 +475,9 @@ test_large (struct backtrace_state *state)
}
uncompress_sizearg = uncompressed_bufsize;
r = uncompress (uncompressed_buf, &uncompress_sizearg,
compressed_buf + 12, compressed_bufsize - 12);
r = uncompress ((unsigned char *) uncompressed_buf, &uncompress_sizearg,
(unsigned char *) compressed_buf + 12,
compressed_bufsize - 12);
if (clock_gettime (cid, &ts2) < 0)
{