Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys sys/sdt.h: Make sure SDT_PROBE*, DTRACE_PROBE* compi...
details: https://anonhg.NetBSD.org/src/rev/a08e73c9f31c
branches: trunk
changeset: 374527:a08e73c9f31c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Apr 30 08:46:03 2023 +0000
description:
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.
diffstat:
sys/sys/sdt.h | 93 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 70 insertions(+), 23 deletions(-)
diffs (125 lines):
diff -r a47e01d4d06c -r a08e73c9f31c sys/sys/sdt.h
--- a/sys/sys/sdt.h Sun Apr 30 08:45:48 2023 +0000
+++ b/sys/sys/sdt.h Sun Apr 30 08:46:03 2023 +0000
@@ -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 <jb%FreeBSD.org@localhost>
@@ -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) \
+#define SDT_PROBE0(prov, mod, func, name) \
__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) \
- __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
Home |
Main Index |
Thread Index |
Old Index