freebsd-src/cddl
Mark Johnston dabde7d976 libdtrace: Permit taking the address of an identifier without type info
Symbols defined using assembler directives lack type info, but in this
case one ought to be able to cast a pointer to the symbol and
dereference the pointer to get a value.  Without this change, D
disallows this trick since it requires all identifiers to have a type.

Relax the rules slightly and allow an identifier to have type "void" if
we know we're just taking its address.

As a result, the following dtrace invocation works:

  dtrace -n 'tick-1s {printf("%d", *(int *)&`ticks);}'

In particular, since commit b2b974f7ef ("clock: Simplify subr_ticks
and rename"), "ticks" does not have any type info associated with it, so
its value couldn't be printed.  This trick provides a workaround and is
probably generally useful.

Add a regression test which exercises this functionality.

PR:		287752
Reviewed by:	avg
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D51417
2025-07-21 14:57:58 +00:00
..
compat/opensolaris Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:29 -06:00
contrib/opensolaris libdtrace: Permit taking the address of an identifier without type info 2025-07-21 14:57:58 +00:00
lib Fix location of libtpool.so.2 after 5c1ba994a8 2025-06-26 08:12:04 -06:00
sbin zfs: merge openzfs/zfs@3084336ae 2025-05-30 11:17:41 +02:00
share zfs: merge openzfs/zfs@b10992582 2024-10-11 08:43:49 +02:00
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
usr.bin ctfconvert.1: Minor cleanup 2025-06-13 15:24:12 -04:00
usr.libexec Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
usr.sbin libdtrace: Permit taking the address of an identifier without type info 2025-07-21 14:57:58 +00:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.inc build: remove the last vestiges of lint support 2025-06-06 00:55:34 +01:00