[DTrace-devel] [PATCH] Initialize variable to eliminate compile-time warning
Kris Van Hees
kris.van.hees at oracle.com
Mon Apr 25 19:23:45 UTC 2022
There is only a compilation error there when you use an older compiler,
because it fails to recognize that the 4 cases in the switch are exactly
the only four cases that could ever happen in this code and thus rc is
guaranteed to always have a value.
On Fri, Apr 22, 2022 at 12:27:19PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
> libdtrace/dt_cc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
> index b73789a2..c0556522 100644
> --- a/libdtrace/dt_cc.c
> +++ b/libdtrace/dt_cc.c
> @@ -2374,7 +2374,7 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,
> ctf_file_t *cfp = dtp->dt_shared_ctf;
> ctf_id_t type = ctf_lookup_by_name(cfp, "struct task_struct");
> ctf_membinfo_t ctm;
> - int rc;
> + ctf_id_t rc = CTF_ERR;
>
> if (type == CTF_ERR)
> return -1;
> --
> 2.18.4
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list