Module Name: src Committed By: riastradh Date: Sun Apr 30 08:46:03 UTC 2023
Modified Files: src/sys/sys: sdt.h Log Message: sys/sdt.h: Make sure SDT_PROBE*, DTRACE_PROBE* compile the arguments. This way there's no need to fuss around with conditional declarations and assignments in the callers to avoid `variable set but not used' errors in builds without KDTRACE_HOOKS. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/sys/sdt.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/sys/sdt.h diff -u src/sys/sys/sdt.h:1.19 src/sys/sys/sdt.h:1.20 --- src/sys/sys/sdt.h:1.19 Sun Apr 30 08:45:39 2023 +++ src/sys/sys/sdt.h Sun Apr 30 08:46:03 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sdt.h,v 1.19 2023/04/30 08:45:39 riastradh Exp $ */ +/* $NetBSD: sdt.h,v 1.20 2023/04/30 08:46:03 riastradh Exp $ */ /*- * Copyright 2006-2008 John Birrell <j...@freebsd.org> @@ -96,8 +96,14 @@ #define SDT_PROVIDER_DECLARE(prov) #define SDT_PROBE_DEFINE(prov, mod, func, name) #define SDT_PROBE_DECLARE(prov, mod, func, name) -#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ - __nothing +#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); \ + __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); \ + __MACROUSE((uintptr_t)(arg3)); \ + __MACROUSE((uintptr_t)(arg4)); \ +} while (0) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) #define SDT_PROBE_DEFINE0(prov, mod, func, name) @@ -111,19 +117,45 @@ #define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, \ arg3, arg4, arg5, arg6) -#define SDT_PROBE0(prov, mod, func, name) __nothing -#define SDT_PROBE1(prov, mod, func, name, arg0) __nothing -#define SDT_PROBE2(prov, mod, func, name, arg0, arg1) __nothing -#define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2) __nothing -#define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ - __nothing -#define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ - __nothing -#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \ - __nothing -#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \ - arg6) \ +#define SDT_PROBE0(prov, mod, func, name) \ __nothing +#define SDT_PROBE1(prov, mod, func, name, arg0) \ + __MACROUSE((uintptr_t)(arg0)) +#define SDT_PROBE2(prov, mod, func, name, arg0, arg1) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ +} while (0) +#define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); \ +} while (0) +#define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ +} while (0) +#define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ + __MACROUSE((uintptr_t)(arg4)); \ +} while (0) +#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, \ + arg5) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ + __MACROUSE((uintptr_t)(arg4)); __MACROUSE((uintptr_t)(arg5)); \ +} while (0) +#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, \ + arg5, arg6) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ + __MACROUSE((uintptr_t)(arg4)); __MACROUSE((uintptr_t)(arg5)); \ + __MACROUSE((uintptr_t)(arg6)); \ +} while (0) #define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name) #define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) @@ -143,17 +175,32 @@ #define SDT_VAR_DECL(decl) __nothing -#define DTRACE_PROBE(name) __nothing -#define DTRACE_PROBE1(name, type0, arg0) __nothing -#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) __nothing -#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) \ +#define DTRACE_PROBE(name) \ __nothing +#define DTRACE_PROBE1(name, type0, arg0) \ + __MACROUSE((uintptr_t)(arg0)) +#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ +} while (0) +#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); \ +} while (0) #define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, \ - arg3) \ - __nothing + arg3) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ +} while (0) #define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, \ - arg3, type4, arg4) \ - __nothing + arg3, type4, arg4) do \ +{ \ + __MACROUSE((uintptr_t)(arg0)); __MACROUSE((uintptr_t)(arg1)); \ + __MACROUSE((uintptr_t)(arg2)); __MACROUSE((uintptr_t)(arg3)); \ + __MACROUSE((uintptr_t)(arg4)); \ +} while (0) #else