[PATCH] pipeline: fix build with sanitizers or debug options

Marat Khalili marat.khalili at huawei.com
Mon Mar 23 12:57:57 CET 2026


> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Friday 20 March 2026 13:33
> To: dev at dpdk.org
> Cc: stable at dpdk.org; Cristian Dumitrescu <cristian.dumitrescu at 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 at dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand at 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.


More information about the dev mailing list