[DTrace-devel] [PATCH] libdtrace: Fix switch statement errors for older compilers

Alan Maguire alan.maguire at oracle.com
Fri Aug 7 13:43:10 UTC 2026


For older gcc we see

CC: libdtrace/dt_btf.c
libdtrace/dt_btf.c: In function ‘dt_btf_func_is_traceable’:
libdtrace/dt_btf.c:1053:3: error: label at end of compound statement
   default:
   ^~~~~~~
libdtrace/dt_btf.c:1081:4: error: label at end of compound statement
    default:
    ^~~~~~~
make: *** [Makerules:14: /home/almagui/src/dtrace/build/libdtrace--dt_btf.o] Error 1

This is because a statement is required in the default: label.
Add a break statement to suppress the error.

Signed-off-by: Alan Maguire <alan.maguire at oracle.com>
---
 libdtrace/dt_btf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libdtrace/dt_btf.c b/libdtrace/dt_btf.c
index 1f793397..9715cc3f 100644
--- a/libdtrace/dt_btf.c
+++ b/libdtrace/dt_btf.c
@@ -1052,6 +1052,7 @@ dt_btf_func_is_traceable(dtrace_hdl_t *dtp, const dt_btf_t *btf, uint32_t id)
 			return 0;
 		default:
 			/* fall-through */
+			break;
 		}
 	}
 
@@ -1080,6 +1081,7 @@ dt_btf_func_is_traceable(dtrace_hdl_t *dtp, const dt_btf_t *btf, uint32_t id)
 					return 0;
 			default:
 				/* fall-through */
+				break;
 			}
 		}
 	}
-- 
2.43.5




More information about the DTrace-devel mailing list