[DTrace-devel] [PATCH] Initialize variable to eliminate compile-time warning

Eugene Loh eugene.loh at oracle.com
Mon Apr 25 20:24:39 UTC 2022


Also, I haven't looked carefully at compiler dependence, but this 
complaint doesn't arise when building on a fresh OL7 system but it does 
seem to with a fresh OL8.

On 4/25/22 4:15 PM, Eugene Loh wrote:
> Right. So... R-b?  Eliminate an unnecessary sensitivity to compiler.
>
> (Also, FWIW, the patch changes the type from int to ctf_id_t, which is 
> 8 bytes.)
>
> On 4/25/22 3:23 PM, Kris Van Hees wrote:
>> 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