[v2] devtools: stop compiler atomics with no C11 equivalent
Checks
Commit Message
Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
to ease future adoption of C11 standard atomics.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
devtools/checkpatches.sh | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Tuesday, 4 April 2023 02.22
>
> Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> to ease future adoption of C11 standard atomics.
Seems I forgot to ack v1 when I commented it, so:
Acked-by: Morten Brørup <mb@smartsharesystems.com>
On Tue, Apr 4, 2023 at 2:21 AM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> to ease future adoption of C11 standard atomics.
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> devtools/checkpatches.sh | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index a07bbc8..1b6841b 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> "$1" || res=1
>
> + # refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
> + awk -v FOLDERS="lib drivers app examples" \
> + -v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
> + -v RET_ON_FAIL=1 \
> + -v MESSAGE='Using __atomic_op_fetch use __atomic_fetch_op instead' \
> + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> + "$1" || res=1
> +
> # forbid use of __reserved which is a reserved keyword in Windows system headers
> awk -v FOLDERS="lib drivers app examples" \
> -v EXPRESSIONS='\\<__reserved\\>' \
> --
> 1.8.3.1
I tweaked the warning message a bit, and applied.
Thanks.
@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
"$1" || res=1
+ # refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch()
+ awk -v FOLDERS="lib drivers app examples" \
+ -v EXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
+ -v RET_ON_FAIL=1 \
+ -v MESSAGE='Using __atomic_op_fetch use __atomic_fetch_op instead' \
+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+ "$1" || res=1
+
# forbid use of __reserved which is a reserved keyword in Windows system headers
awk -v FOLDERS="lib drivers app examples" \
-v EXPRESSIONS='\\<__reserved\\>' \