public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] pipeline: fix build with sanitizers or debug options
@ 2026-03-20 13:33 David Marchand
  2026-03-20 17:38 ` Dumitrescu, Cristian
  2026-03-23 11:57 ` Marat Khalili
  0 siblings, 2 replies; 4+ messages in thread
From: David Marchand @ 2026-03-20 13:33 UTC (permalink / raw)
  To: dev; +Cc: stable, Cristian Dumitrescu

Similar to commit 84f5ac9418ea ("pipeline: fix build with ASan").

Here we are again. Depending on options (like debug, or ASan, or UBSan),
compilation can fail because of dumb construct like CHECK(0, XXX).
Dumb, because such an expression macro expands as: if (0) return -XXX;

../lib/pipeline/rte_swx_pipeline.c: In function ‘instr_movh_translate’:
../lib/pipeline/rte_swx_pipeline.c:3461:1: error: control reaches end of
	non-void function [-Werror=return-type]
 3461 | }
      | ^

Remove any such call when at the end of functions, using a regexp:
%s/CHECK(0, \(.*\))\(;\n}\)/return -\1\2/

Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/pipeline/rte_swx_pipeline.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index a9157815e4..8ceb1fe88d 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -2524,7 +2524,7 @@ instr_table_translate(struct rte_swx_pipeline *p,
 		return 0;
 	}
 
-	CHECK(0, EINVAL);
+	return -EINVAL;
 }
 
 static inline void
@@ -3049,7 +3049,7 @@ instr_extern_translate(struct rte_swx_pipeline *p,
 		return 0;
 	}
 
-	CHECK(0, EINVAL);
+	return -EINVAL;
 }
 
 static inline void
@@ -3457,7 +3457,7 @@ instr_movh_translate(struct rte_swx_pipeline *p,
 		return 0;
 	}
 
-	CHECK(0, EINVAL);
+	return -EINVAL;
 }
 
 static inline void
-- 
2.53.0


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

* RE: [PATCH] pipeline: fix build with sanitizers or debug options
  2026-03-20 13:33 [PATCH] pipeline: fix build with sanitizers or debug options David Marchand
@ 2026-03-20 17:38 ` Dumitrescu, Cristian
  2026-03-23 11:57 ` Marat Khalili
  1 sibling, 0 replies; 4+ messages in thread
From: Dumitrescu, Cristian @ 2026-03-20 17:38 UTC (permalink / raw)
  To: David Marchand, dev@dpdk.org; +Cc: stable@dpdk.org



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, March 20, 2026 1:33 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] pipeline: fix build with sanitizers or debug options
> 
> Similar to commit 84f5ac9418ea ("pipeline: fix build with ASan").
> 
> Here we are again. Depending on options (like debug, or ASan, or UBSan),
> compilation can fail because of dumb construct like CHECK(0, XXX).
> Dumb, because such an expression macro expands as: if (0) return -XXX;
> 
> ../lib/pipeline/rte_swx_pipeline.c: In function ‘instr_movh_translate’:
> ../lib/pipeline/rte_swx_pipeline.c:3461:1: error: control reaches end of
> 	non-void function [-Werror=return-type]
>  3461 | }
>       | ^
> 
> Remove any such call when at the end of functions, using a regexp:
> %s/CHECK(0, \(.*\))\(;\n}\)/return -\1\2/
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

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

* RE: [PATCH] pipeline: fix build with sanitizers or debug options
  2026-03-20 13:33 [PATCH] pipeline: fix build with sanitizers or debug options David Marchand
  2026-03-20 17:38 ` Dumitrescu, Cristian
@ 2026-03-23 11:57 ` Marat Khalili
  2026-03-24  6:58   ` David Marchand
  1 sibling, 1 reply; 4+ messages in thread
From: Marat Khalili @ 2026-03-23 11:57 UTC (permalink / raw)
  To: David Marchand, dev@dpdk.org; +Cc: stable@dpdk.org, Cristian Dumitrescu

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday 20 March 2026 13:33
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Subject: [PATCH] pipeline: fix build with sanitizers or debug options
> 
> Similar to commit 84f5ac9418ea ("pipeline: fix build with ASan").
> 
> Here we are again. Depending on options (like debug, or ASan, or UBSan),
> compilation can fail because of dumb construct like CHECK(0, XXX).
> Dumb, because such an expression macro expands as: if (0) return -XXX;
> 
> ../lib/pipeline/rte_swx_pipeline.c: In function ‘instr_movh_translate’:
> ../lib/pipeline/rte_swx_pipeline.c:3461:1: error: control reaches end of
> 	non-void function [-Werror=return-type]
>  3461 | }
>       | ^
> 
> Remove any such call when at the end of functions, using a regexp:
> %s/CHECK(0, \(.*\))\(;\n}\)/return -\1\2/
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/pipeline/rte_swx_pipeline.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
> index a9157815e4..8ceb1fe88d 100644
> --- a/lib/pipeline/rte_swx_pipeline.c
> +++ b/lib/pipeline/rte_swx_pipeline.c
> @@ -2524,7 +2524,7 @@ instr_table_translate(struct rte_swx_pipeline *p,
>  		return 0;
>  	}
> 
> -	CHECK(0, EINVAL);
> +	return -EINVAL;
>  }
> 
>  static inline void
> @@ -3049,7 +3049,7 @@ instr_extern_translate(struct rte_swx_pipeline *p,
>  		return 0;
>  	}
> 
> -	CHECK(0, EINVAL);
> +	return -EINVAL;
>  }
> 
>  static inline void
> @@ -3457,7 +3457,7 @@ instr_movh_translate(struct rte_swx_pipeline *p,
>  		return 0;
>  	}
> 
> -	CHECK(0, EINVAL);
> +	return -EINVAL;
>  }
> 
>  static inline void
> --
> 2.53.0

Should we only fix those at the end of a function? Other cases may not cause
issues immediately, but may still confuse compilers and readers in the future.

We are using the following hot-patch command in our CI:

```bash
sed -r 's/\bCHECK\(0, (\w+)\)/return -\1/g' -i lib/pipeline/rte_swx_pipeline.c
```

And it performs 6 replacements.

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

* Re: [PATCH] pipeline: fix build with sanitizers or debug options
  2026-03-23 11:57 ` Marat Khalili
@ 2026-03-24  6:58   ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2026-03-24  6:58 UTC (permalink / raw)
  To: Marat Khalili; +Cc: dev@dpdk.org, stable@dpdk.org, Cristian Dumitrescu

Hello,

On Mon, 23 Mar 2026 at 12:58, Marat Khalili <marat.khalili@huawei.com> wrote:
> Should we only fix those at the end of a function? Other cases may not cause
> issues immediately, but may still confuse compilers and readers in the future.
>
> We are using the following hot-patch command in our CI:
>
> ```bash
> sed -r 's/\bCHECK\(0, (\w+)\)/return -\1/g' -i lib/pipeline/rte_swx_pipeline.c
> ```
>
> And it performs 6 replacements.

Yep, I did this on purpose: I fixed what was breaking compilation.
The other cases are not strictly wrong.
Usage of this macro seemed intentional (for consistency?) so I did not
touch the rest.


-- 
David Marchand


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

end of thread, other threads:[~2026-03-24  6:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 13:33 [PATCH] pipeline: fix build with sanitizers or debug options David Marchand
2026-03-20 17:38 ` Dumitrescu, Cristian
2026-03-23 11:57 ` Marat Khalili
2026-03-24  6:58   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox