All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Rename _DTRACE_VERSION
@ 2025-02-08 19:06 eugene.loh
  2025-02-08 19:06 ` [PATCH 2/4] Eliminate DT_VERS_LATEST eugene.loh
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: eugene.loh @ 2025-02-08 19:06 UTC (permalink / raw)
  To: dtrace, dtrace-devel

From: Eugene Loh <eugene.loh@oracle.com>

There are many DTrace version numbers (for version, API version,
package version, etc.).  Meanwhile, _DTRACE_VERSION is not a
version number at all.  It's a preprocessor macro in USDT .h header
files.  Prior to commit e2fb0ecd9
("Ensure multiple passes through dtrace -G work."), it was perhaps
not even set.  With that commit, it was always set to 1, with
the rationale:

    Also add an explicit define for _DTRACE__VERSION in the generated
    header file from 'dtrace -h' invocations.  This seems silly, but
    it is there to give people a skeleton to work with if they want to
    pre-generate header files and select whether to actually compile
    on the probes at a later time.

Rename to _DTRACE_HEADER for better clarity.  Define it only once
per file.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 libdtrace/dt_program.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libdtrace/dt_program.c b/libdtrace/dt_program.c
index 23b91fb2e..c6fdafb47 100644
--- a/libdtrace/dt_program.c
+++ b/libdtrace/dt_program.c
@@ -505,13 +505,12 @@ dt_header_provider(dtrace_hdl_t *dtp, dt_provider_t *pvp, FILE *out)
 	info.dthi_pfname = alloca(strlen(pvp->desc.dtvd_name) + 1 + i);
 	dt_header_fmt_func(info.dthi_pfname, pvp->desc.dtvd_name);
 
-	if (fprintf(out, "#define _DTRACE_VERSION 1\n\n"
-			 "#if _DTRACE_VERSION\n\n") < 0)
+	if (fprintf(out, "#if _DTRACE_HEADER\n\n") < 0)
 		return dt_set_errno(dtp, errno);
 
 	if (dt_idhash_iter(pvp->pv_probes, dt_header_probe, &info) != 0)
 		return -1; /* dt_errno is set for us */
-	if (fprintf(out, "\n\n") < 0)
+	if (fprintf(out, "\n") < 0)
 		return dt_set_errno(dtp, errno);
 	if (dt_idhash_iter(pvp->pv_probes, dt_header_decl, &info) != 0)
 		return -1; /* dt_errno is set for us */
@@ -560,6 +559,9 @@ dtrace_program_header(dtrace_hdl_t *dtp, FILE *out, const char *fname)
 		"#endif\n\n") < 0)
 		return -1;
 
+	if (fprintf(out, "#define _DTRACE_HEADER 1\n\n") < 0)
+		return -1;
+
 	while ((pvp = dt_htab_next(dtp->dt_provs, &it)) != NULL) {
 		if (dt_header_provider(dtp, pvp, out) != 0) {
 			dt_htab_next_destroy(it);
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-18 20:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08 19:06 [PATCH 1/4] Rename _DTRACE_VERSION eugene.loh
2025-02-08 19:06 ` [PATCH 2/4] Eliminate DT_VERS_LATEST eugene.loh
2025-02-27 16:40   ` Kris Van Hees
2025-02-27 16:57     ` [DTrace-devel] " Kris Van Hees
2025-02-28  3:19       ` Kris Van Hees
2025-02-08 19:06 ` [PATCH 3/4] Sync up the version numbers eugene.loh
2025-02-08 19:06 ` [PATCH 4/4] test: Add test for predefined preprocessor definitions eugene.loh
2025-03-18 19:18   ` Kris Van Hees
2025-03-18 20:35     ` Eugene Loh
2025-03-18 20:42       ` Kris Van Hees
2025-02-27 16:27 ` [PATCH 1/4] Rename _DTRACE_VERSION Kris Van Hees

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.