Address compiler warnings in C code used by the DTrace test suite.

Reported by:	Jenkins
MFC after:	1 week
This commit is contained in:
Mark Johnston 2020-09-19 16:15:22 +00:00
parent d26ab2bec0
commit c6989859ae
33 changed files with 105 additions and 112 deletions

View File

@ -24,6 +24,8 @@
* Use is subject to license terms.
*/
void frax(void);
__attribute__((optnone)) void
frax(void)
{

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ioctl.h>
#include <assert.h>
@ -48,7 +46,8 @@ int
main(int argc, char *argv[])
{
const char *file = "/dev/null";
int i, n, fds[10];
size_t i, n;
int fds[10];
struct sigaction act;
if (argc > 1) {

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
typedef void f(int x);

View File

@ -24,43 +24,43 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/cdefs.h>
typedef void f(char *);
static void
f_a(char *a)
f_a(char *a __unused)
{
}
static void
f_b(char *a)
f_b(char *a __unused)
{
}
static void
f_c(char *a)
f_c(char *a __unused)
{
}
static void
f_d(char *a)
f_d(char *a __unused)
{
}
static void
f_e(char *a)
f_e(char *a __unused)
{
}
static void
fN(f func, char *a, int i)
fN(f func, char *a, int i __unused)
{
func(a);
}
static void
fN2(f func, char *a, int i)
fN2(f func, char *a, int i __unused)
{
func(a);
}

View File

@ -28,6 +28,8 @@
" \"action\": \"%s\"" \
"}\n"
int waiting(volatile int *);
int
waiting(volatile int *a)
{
@ -35,7 +37,7 @@ waiting(volatile int *a)
}
int
main(int argc, char **argv)
main(void)
{
volatile int a = 0;
int idx;
@ -45,7 +47,8 @@ main(int argc, char **argv)
continue;
for (idx = 0; idx < 10; idx++) {
char *odd, *even, *json, *action;
const char *odd, *even, *action;
char *json;
size *= 1.78;
odd = idx % 2 == 1 ? "true" : "false";
@ -57,7 +60,7 @@ main(int argc, char **argv)
free(json);
}
BUNYAN_FAKE_LOG_DEBUG("{\"finished\": true}");
BUNYAN_FAKE_LOG_DEBUG(__DECONST(char *, "{\"finished\": true}"));
return (0);
}

View File

@ -18,10 +18,10 @@
*/
provider bunyan_fake {
probe log__trace(char *msg);
probe log__debug(char *msg);
probe log__info(char *msg);
probe log__warn(char *msg);
probe log__error(char *msg);
probe log__fatal(char *msg);
probe log__trace(const char *msg);
probe log__debug(const char *msg);
probe log__info(const char *msg);
probe log__warn(const char *msg);
probe log__error(const char *msg);
probe log__fatal(const char *msg);
};

View File

@ -24,28 +24,30 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
int go(long, long, long, long, long, long, long, long, long, long);
int
go(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6,
long arg7, long arg8, long arg9)
go(long arg0 __unused, long arg1 __unused, long arg2 __unused,
long arg3 __unused, long arg4 __unused, long arg5 __unused,
long arg6 __unused, long arg7 __unused, long arg8 __unused,
long arg9 __unused)
{
return (arg1);
}
static void
handle(int sig)
handle(int sig __unused)
{
go(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
(void) signal(SIGUSR1, handle);
for (;;)

View File

@ -24,14 +24,14 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
extern volatile double c;
volatile double c = 1.2;
int
main(int argc, char **argv)
main(int argc, char **argv __unused)
{
double a = 1.56;
double b = (double)argc;

View File

@ -24,10 +24,11 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
int waiting(volatile int *);
int go(void);
int
waiting(volatile int *a)
{
@ -49,7 +50,7 @@ go(void)
}
int
main(int argc, char **argv)
main(void)
{
volatile int a = 0;

View File

@ -24,14 +24,15 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/wait.h>
#include <spawn.h>
#include <signal.h>
#include <stdio.h>
void go(void);
void intr(int);
void
go(void)
{
@ -43,12 +44,12 @@ go(void)
}
void
intr(int sig)
intr(int sig __unused)
{
}
int
main(int argc, char **argv)
main(void)
{
struct sigaction sa;

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@ -35,6 +33,11 @@
* leading underscores.
*/
extern int a;
int help(void);
int go(void);
int a = 100;
int
@ -50,14 +53,14 @@ go(void)
}
static void
handle(int sig)
handle(int sig __unused)
{
go();
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
(void) signal(SIGUSR1, handle);
for (;;)

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@ -35,6 +33,10 @@
* leading underscores.
*/
extern int a;
int go(void);
int a = 100;
int
@ -44,14 +46,14 @@ go(void)
}
static void
handle(int sig)
handle(int sig __unused)
{
go();
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
(void) signal(SIGUSR1, handle);
for (;;)

View File

@ -24,10 +24,11 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
int waiting(volatile int *);
int go(void);
int
waiting(volatile int *a)
{
@ -49,7 +50,7 @@ go(void)
}
int
main(int argc, char **argv)
main(void)
{
volatile int a = 0;

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@ -37,6 +35,8 @@
#pragma weak _go = go
int go(int);
int
go(int a)
{
@ -44,14 +44,14 @@ go(int a)
}
static void
handle(int sig)
handle(int sig __unused)
{
_go(1);
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
(void) signal(SIGUSR1, handle);
for (;;)

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@ -35,7 +33,7 @@
* leading underscores.
*/
static int
static int __unused
go(int a)
{
return (a + 1);
@ -44,14 +42,14 @@ go(int a)
#pragma weak _go = go
static void
handle(int sig)
handle(int sig __unused)
{
_go(1);
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
(void) signal(SIGUSR1, handle);
for (;;)

View File

@ -26,7 +26,7 @@
#include <unistd.h>
int
main(int argc, char **argv)
main(void)
{
for (;;)

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <time.h>
#include <stdlib.h>
@ -36,7 +34,7 @@
#define NANOSEC 1000000000
int
main(int argc, char **argv)
main(int argc __unused, char **argv)
{
struct sigevent ev;
struct itimerspec ts;

View File

@ -24,32 +24,32 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/cdefs.h>
typedef void f(int x);
static void
f_a(int i)
f_a(int i __unused)
{
}
static void
f_b(int i)
f_b(int i __unused)
{
}
static void
f_c(int i)
f_c(int i __unused)
{
}
static void
f_d(int i)
f_d(int i __unused)
{
}
static void
f_e(int i)
f_e(int i __unused)
{
}
@ -60,7 +60,7 @@ fN(f func, int i)
}
int
main()
main(void)
{
fN(f_a, 1);
fN(f_b, 2);

View File

@ -24,13 +24,11 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <signal.h>
int
main(int argc, char **argv)
main(void)
{
sigset_t ss;

View File

@ -24,20 +24,18 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
static void
handle(int sig)
handle(int sig __unused)
{
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
struct sigaction sa;

View File

@ -24,20 +24,18 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
static void
handle(int sig)
handle(int sig __unused)
{
exit(0);
}
int
main(int argc, char **argv)
main(void)
{
struct sigaction sa;

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/sysctl.h>
@ -33,7 +31,7 @@
#include <unistd.h>
int
main(int argc, char **argv)
main(void)
{
int val = 1;

View File

@ -24,12 +24,10 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
int
main(int argc, char **argv)
main(void)
{
for (;;) {
getpid();

View File

@ -24,12 +24,10 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
int
main(int argc, char **argv)
main(void)
{
for (;;) {
getpid();

View File

@ -24,15 +24,13 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
/*ARGSUSED*/
int
main(int argc, char **argv)
main(void)
{
for (;;) {
(void) __syscall(SYS_mmap, NULL, (size_t)1, 2, 3, -1,

View File

@ -24,6 +24,8 @@ typedef struct season_7_lisa_the_vegetarian {
int fr_salad;
} season_7_lisa_the_vegetarian_t;
int sleeper(season_7_lisa_the_vegetarian_t *);
int
sleeper(season_7_lisa_the_vegetarian_t *lp)
{

View File

@ -22,9 +22,9 @@
#include <unistd.h>
typedef struct zelda_info {
char *zi_gamename;
const char *zi_gamename;
int zi_ndungeons;
char *zi_villain;
const char *zi_villain;
int zi_haszelda;
} zelda_info_t;

View File

@ -27,19 +27,19 @@ typedef struct final_fantasy_info {
} final_fantasy_info_t;
static int
ff_getgameid(final_fantasy_info_t *f)
ff_getgameid(final_fantasy_info_t *f __unused)
{
return (0);
}
static int
ff_getpartysize(final_fantasy_info_t *f)
ff_getpartysize(final_fantasy_info_t *f __unused)
{
return (0);
}
static int
ff_getsummons(final_fantasy_info_t *f)
ff_getsummons(final_fantasy_info_t *f __unused)
{
return (0);
}

View File

@ -24,12 +24,10 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sdt.h>
int
main(int argc, char **argv)
main(void)
{
for (;;) {
DTRACE_PROBE2(test_prov, place, 10, 4);

View File

@ -24,12 +24,10 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sdt.h>
int
main(int argc, char **argv)
main(void)
{
for (;;) {
DTRACE_PROBE2(test_prov, place, 10, 4);

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/wait.h>
@ -35,7 +33,7 @@
#include "forker.h"
int
main(int argc, char **argv)
main(void)
{
int i;

View File

@ -24,12 +24,11 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void grow(int);
void grow1(int);
void
@ -53,7 +52,7 @@ grow1(int frame)
}
int
main(int argc, char *argv[])
main(void)
{
grow(1);

View File

@ -24,12 +24,16 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
extern volatile long long count;
volatile long long count = 0;
int baz(int);
int bar(int);
int foo(int, int);
int
baz(int a)
{
@ -57,5 +61,5 @@ foo(int a, int b)
int
main(int argc, char **argv)
{
return (foo(argc, (int)argv) == 0);
return (foo(argc, (int)(uintptr_t)argv) == 0);
}