[PATCH v4 13/13] devtools: check for some reentrant function

Stephen Hemminger stephen at networkplumber.org
Sun Oct 27 04:11:18 CET 2024


On Sat, 26 Oct 2024 18:14:51 +0800
Jie Hai <haijie1 at huawei.com> wrote:

> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index d860f190457e..8c3d32d8e552 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -145,6 +145,14 @@ check_forbidden_additions() { # <patch>
>  		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
>  		"$1" || res=1
>  
> +	# refrain from using some non-reentrant functions
> +	awk -v FOLDERS="lib drivers app examples" \
> +		-v EXPRESSIONS="strtok\\\(" \
> +		-v RET_ON_FAIL=1 \
> +		-v MESSAGE='Using non-reentrant function strtok, prefer strtok_r' \
> +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> +		"$1" || res=1
> +
>  	# refrain from using some pthread functions
>  	awk -v FOLDERS="lib drivers app examples" \
>  		-v EXPRESSIONS="pthread_(create|join|detach|set(_?name_np|affinity_np)|attr_set(inheritsched|schedpolicy))\\\(" \

Ok, but checkpatch keeps getting slower and slower with all this copy baset.
Could someone make it into a python script without so much copy/paste?


More information about the dev mailing list