Re: [Cocci] Replacing the type casting

2020-02-08 Thread Ondřej Surý
Hi Markus, I ended up with: ``` @@ type T; expression source; @@ - REQUIRE(((T *)source) != NULL); + REQUIRE(source != NULL); @@ type T; typedef dns_rdatacommon_t; identifier common, rdtype; identifier source; @@ REQUIRE(( - (T *)source + (dns_rdatacommon_t *)source )-> - common.

[Cocci] Replacing the type casting

2020-02-08 Thread Ondřej Surý
the rule fail. Thanks, Ondrej -- Ondřej Surý ond...@sury.org ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

[Cocci] "already tagged token" error?

2019-11-21 Thread Ondřej Surý
@@ type T; expression V, E1, E2; @@ - V = (T)isc_mem_get(E1, E2); + V = isc_mem_get(E1, E2); Thank you, -- Ondřej Surý ond...@sury.org ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

Re: [Cocci] Detecting functions with dummy return value

2019-11-01 Thread Ondřej Surý
Hi Julia, thanks for the quick response. > On 1 Nov 2019, at 14:09, Julia Lawall wrote: > > This is not possible. ... describes control-flow paths. Nothing happens > after a return. Your attempt above would match functions where all > control-flow paths end with return (ISC_R_SUCCESS);,

[Cocci] Detecting functions with dummy return value

2019-11-01 Thread Ondřej Surý
Hi, we changed our allocator (wrapper) function to assert() instead of returning ISC_R_MEMORY. As you can imagine there’s a lot of checks down the road that needs to be cleaned up, so I am looking for a way to detect function that only does: isc_result_t foo(…) { … return (ISC_R_SUCCESS); }