From: Paul Floyd Date: Sun, 27 Aug 2023 14:57:24 +0000 (+0200) Subject: regtest: fix compiler warnings with clang 16 X-Git-Tag: VALGRIND_3_22_0~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f28b44348a0467b6026a099a224ef96f83181d7;p=thirdparty%2Fvalgrind.git regtest: fix compiler warnings with clang 16 Mostly warnings about deprecated use of K&R function definitions. --- diff --git a/drd/tests/dlopen_lib.c b/drd/tests/dlopen_lib.c index ea18fc5439..34d6167614 100644 --- a/drd/tests/dlopen_lib.c +++ b/drd/tests/dlopen_lib.c @@ -18,7 +18,7 @@ void foo() int rc; uintptr_t t = 1; - printf("In main: creating thread %ld\n", t); + printf("In main: creating thread %u\n", (unsigned)t); rc = pthread_create(&thread, NULL, PrintHello, (void *)t); if (rc) printf("ERROR; return code from pthread_create() is %d\n", rc); diff --git a/memcheck/tests/vcpu_fbench.c b/memcheck/tests/vcpu_fbench.c index 6a7767d8cf..2f05eb86fd 100644 --- a/memcheck/tests/vcpu_fbench.c +++ b/memcheck/tests/vcpu_fbench.c @@ -380,8 +380,7 @@ static double atanc[] = { /* aint(x) Return integer part of number. Truncates towards 0 */ -double aint(x) -double x; +double aint(double x) { long l; @@ -398,8 +397,7 @@ double x; /* sin(x) Return sine, x in radians */ -static double sin(x) -double x; +static double sin(double x) { int sign; double y, r, z; @@ -437,8 +435,7 @@ double x; /* cos(x) Return cosine, x in radians, by identity */ -static double cos(x) -double x; +static double cos(double x) { x = (x < 0.0) ? -x : x; if (x > twopi) /* Do range reduction here to limit */ @@ -448,8 +445,7 @@ double x; /* tan(x) Return tangent, x in radians, by identity */ -static double tan(x) -double x; +static double tan(double x) { return sin(x) / cos(x); } @@ -457,8 +453,7 @@ double x; /* sqrt(x) Return square root. Initial guess, then Newton- Raphson refinement */ -double sqrt(x) -double x; +double sqrt(double x) { double c, cl, y; int n; @@ -490,8 +485,7 @@ double x; /* atan(x) Return arctangent in radians, range -pi/2 to pi/2 */ -static double atan(x) -double x; +static double atan(double x) { int sign, l, y; double a, b, z; @@ -530,8 +524,7 @@ atl: /* atan2(y,x) Return arctangent in radians of y/x, range -pi to pi */ -static double atan2(y, x) -double y, x; +static double atan2(double y, double x) { double temp; @@ -555,8 +548,7 @@ double y, x; /* asin(x) Return arcsine in radians of x */ -static double asin(x) -double x; +static double asin(double x) { if (fabs(x)>1.0) { fprintf(stderr, @@ -674,9 +666,7 @@ static void transit_surface() { /* Perform ray trace in specific spectral line */ -static void trace_line(line, ray_h) -int line; -double ray_h; +static void trace_line(int line, double ray_h) { int i; @@ -701,9 +691,7 @@ double ray_h; /* Initialise when called the first time */ -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char* argv[]) { int i, j, k, errors; double od_fline, od_cline; diff --git a/none/tests/unit_debuglog.c b/none/tests/unit_debuglog.c index 7a71d04d27..fc1d59326f 100644 --- a/none/tests/unit_debuglog.c +++ b/none/tests/unit_debuglog.c @@ -16,7 +16,7 @@ #include "coregrind/m_debuglog.c" -void run(const char *format, ...) +int run(const char *format, ...) { int n, num_stars; const char *p; @@ -44,6 +44,8 @@ void run(const char *format, ...) emit(buf.buf, strlen(buf.buf)); fprintf(stderr, "\twrote %3d chars\n", n); + + return num_stars; } int main(int argc, char *argv[]) diff --git a/perf/fbench.c b/perf/fbench.c index 79bbb3ec5e..4a6090ee5f 100644 --- a/perf/fbench.c +++ b/perf/fbench.c @@ -376,8 +376,7 @@ static double atanc[] = { /* aint(x) Return integer part of number. Truncates towards 0 */ -double aint(x) -double x; +double aint(double x) { long l; @@ -394,8 +393,7 @@ double x; /* sin(x) Return sine, x in radians */ -static double sin(x) -double x; +static double sin(double x) { int sign; double y, r, z; @@ -433,8 +431,7 @@ double x; /* cos(x) Return cosine, x in radians, by identity */ -static double cos(x) -double x; +static double cos(double x) { x = (x < 0.0) ? -x : x; if (x > twopi) /* Do range reduction here to limit */ @@ -444,8 +441,7 @@ double x; /* tan(x) Return tangent, x in radians, by identity */ -static double tan(x) -double x; +static double tan(double x) { return sin(x) / cos(x); } @@ -453,8 +449,7 @@ double x; /* sqrt(x) Return square root. Initial guess, then Newton- Raphson refinement */ -double sqrt(x) -double x; +double sqrt(double x) { double c, cl, y; int n; @@ -486,8 +481,7 @@ double x; /* atan(x) Return arctangent in radians, range -pi/2 to pi/2 */ -static double atan(x) -double x; +static double atan(double x) { int sign, l, y; double a, b, z; @@ -526,8 +520,7 @@ atl: /* atan2(y,x) Return arctangent in radians of y/x, range -pi to pi */ -static double atan2(y, x) -double y, x; +static double atan2(double y, double x) { double temp; @@ -551,8 +544,7 @@ double y, x; /* asin(x) Return arcsine in radians of x */ -static double asin(x) -double x; +static double asin(double x) { if (fabs(x)>1.0) { fprintf(stderr, @@ -670,9 +662,7 @@ static void transit_surface() { /* Perform ray trace in specific spectral line */ -static void trace_line(line, ray_h) -int line; -double ray_h; +static void trace_line(int line, double ray_h) { int i; @@ -697,9 +687,7 @@ double ray_h; /* Initialise when called the first time */ -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char* argv[]) { int i, j, k, errors; double od_fline, od_cline; diff --git a/perf/ffbench.c b/perf/ffbench.c index 7a02ce43ac..1fb21914bb 100644 --- a/perf/ffbench.c +++ b/perf/ffbench.c @@ -165,9 +165,7 @@ #define SWAP(a,b) tempr=(a); (a)=(b); (b)=tempr -static void fourn(data, nn, ndim, isign) - Float data[]; - int nn[], ndim, isign; +static void fourn(Float data[], int nn[], int ndim, int isign) { register int i1, i2, i3; int i2rev, i3rev, ip1, ip2, ip3, ifp1, ifp2;