FreeBSD: Use a statement expression to implement SET_ERROR() (#16284)

This way we can avoid making assumptions about the SDT probe
implementation.  No functional change intended.

Signed-off-by: Mark Johnston <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Tino Reichardt <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
This commit is contained in:
Mark Johnston authored and GitHub committed 2024-07-08 17:59:08 -07:00
1 parent fd51786f86
commit f72e081fbf
1 file changed
+6 -5
+6 -5
View File
@@ -31,13 +31,14 @@
#include_next <sys/sdt.h>
#ifdef KDTRACE_HOOKS
/* CSTYLED */
/* BEGIN CSTYLED */
SDT_PROBE_DECLARE(sdt, , , set__error);
#define SET_ERROR(err) \
((sdt_sdt___set__error->id ? \
(*sdt_probe_func)(sdt_sdt___set__error->id, \
(uintptr_t)err, 0, 0, 0, 0) : 0), err)
#define SET_ERROR(err) ({ \
SDT_PROBE1(sdt, , , set__error, (uintptr_t)err); \
err; \
})
/* END CSTYLED */
#else
#define SET_ERROR(err) (err)
#endif