devtools: stop compiler atomics with no C11 equivalent
PATCH 1/1 devtools: stop compiler atomics with no C11 equivalent
Refrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch() to ease future adoption of C11 standard atomics.
--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)
devtools/checkpatches.sh +8 -0
@@ -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_{add,and,nand,or,sub,xor}_fetch' \ + -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\\>' \
Signature · 1 line
1.8.3.1
adding a few more people to cc for attention
Quoted 29 lines · Tyler Retzlaff
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 <[email protected]>--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)devtools/checkpatches.sh +8
-0@@ -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_{add,and,nand,or,sub,xor}_fetch' \ + -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\\>' \Signature · 1 line
1.8.3.1
Quoted 23 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 22 March 2023 19.08adding a few more people to cc for attention
Quoted 13 lines · Tyler Retzlaff
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 <[email protected]>--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)devtools/checkpatches.sh +0
-0devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 119
Quoted 1 line
devtools/checkpatches.sh +0
-0@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk\
Quoted 2 lines
devtools/checkpatches.sh +0
-0"$1" || res=1
Quoted 8 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 122
Quoted 1 line
devtools/checkpatches.sh +1
-0+ # refrain from using compiler__atomic_{add,and,nand,or,sub,xor}_fetch()
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 124
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ awk -v FOLDERS="lib drivers app examples" \ + -vEXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 126
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ -v RET_ON_FAIL=1 \ + -v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch'\
Suggest that you expand the error message with a solution for the developer: "... use __atomic_fetch_op() instead of __atomic_op_fetch()"
Quoted 10 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 127
Quoted 1 line
devtools/checkpatches.sh +1
-0+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk\
devtools/checkpatches.sh check_forbidden_additions() { # <patch>
Quoted 3 lines
devtools/checkpatches.sh +2
-0+ "$1" || res=1 + # forbid use of __reserved which is a reserved keyword in Windowssystem headers
Quoted 4 lines
devtools/checkpatches.sh +0
-1awk -v FOLDERS="lib drivers app examples" \ -v EXPRESSIONS='\\<__reserved\\>' \ --1.8.3.1
Quoted 25 lines · Morten Brørup
Quoted 25 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 22 March 2023 19.08adding a few more people to cc for attention
Quoted 13 lines · Tyler Retzlaff
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 <[email protected]>--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)devtools/checkpatches.sh +0
-0devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 119
Quoted 1 line
devtools/checkpatches.sh +0
-0@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk\
devtools/checkpatches.sh check_forbidden_additions() { # <patch>
Quoted 3 lines
devtools/checkpatches.sh +1
-0"$1" || res=1 + # refrain from using compiler__atomic_{add,and,nand,or,sub,xor}_fetch()
Quoted 8 lines
Quoted 6 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 124
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ awk -v FOLDERS="lib drivers app examples" \ + -vEXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 126
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ -v RET_ON_FAIL=1 \ + -v MESSAGE='Using __atomic_{add,and,nand,or,sub,xor}_fetch'\
Suggest that you expand the error message with a solution for the developer: "... use
__atomic_fetch_op()instead of__atomic_op_fetch()"
if awk could expand captures i would do that but it can't.
or do you mean literally use 'op' instead of {add,and,nand,or,sub,xor} in the message?
Quoted 11 lines
Quoted 11 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 127
Quoted 2 lines
devtools/checkpatches.sh +1
-0+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk\
devtools/checkpatches.sh check_forbidden_additions() { # <patch>
Quoted 3 lines
devtools/checkpatches.sh +2
-0+ "$1" || res=1 + # forbid use of __reserved which is a reserved keyword in Windowssystem headers
Quoted 4 lines
devtools/checkpatches.sh +0
-1awk -v FOLDERS="lib drivers app examples" \ -v EXPRESSIONS='\\<__reserved\\>' \ --1.8.3.1
Quoted 39 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 22 March 2023 22.00Quoted 7 lines · Morten Brørup
Quoted 7 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 22 March 2023 19.08adding a few more people to cc for attention
Quoted 1 line · Tyler Retzlaff
Refrain from using compiler
__atomic_{add,and,nand,or,sub,xor}_fetch()
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
to ease future adoption of C11 standard atomics.
Signed-off-by Tyler Retzlaff <[email protected]>--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 6 lines
Quoted 6 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 119
Quoted 6 lines
devtools/checkpatches.sh +0
-0@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
Quoted 10 lines
Quoted 10 lines
\
devtools/checkpatches.sh check_forbidden_additions() { # <patch>
Quoted 3 lines
devtools/checkpatches.sh +1
-0"$1" || res=1 + # refrain from using compiler__atomic_{add,and,nand,or,sub,xor}_fetch()
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 124
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ awk -v FOLDERS="lib drivers app examples" \ + -vEXPRESSIONS="__atomic_(add|and|nand|or|sub|xor)_fetch\\\(" \
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 126
Quoted 2 lines
devtools/checkpatches.sh +2
-0+ -v RET_ON_FAIL=1 \ + -v MESSAGE='Using__atomic_{add,and,nand,or,sub,xor}_fetch'
Quoted 2 lines
Quoted 1 line
\
Quoted 7 lines
Quoted 1 line
Suggest that you expand the error message with a solution for the
developer: "... use
__atomic_fetch_op()instead of__atomic_op_fetch()"if awk could expand captures i would do that but it can't.
or do you mean literally use 'op' instead of {add,and,nand,or,sub,xor} in the message?
I didn't think about expansion, so literally using "op" in the solution part of the message is exactly what I meant. But please keep the existing part of the message as is.
Alternatively, you can also use "{add,and,nand,or,sub,xor}" instead of "op" in the solution part of the message. Whatever you prefer.
The message could be even more verbose by also adding the reason why __atomic_op_fetch() is prohibited, such as: "... in order to prepare for conversion to C11 stdatomics, where atomic_{add,and,nand,or,sub,xor}_fetch() is unavailable."
Quoted 14 lines
Quoted 3 lines
Quoted 3 lines
devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 127
Quoted 3 lines
devtools/checkpatches.sh +1
-0+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk
Quoted 4 lines
Quoted 4 lines
\
devtools/checkpatches.sh check_forbidden_additions() { # <patch>
Quoted 3 lines
devtools/checkpatches.sh +2
-0+ "$1" || res=1 + # forbid use of __reserved which is a reserved keyword inWindows
Quoted 5 lines
Quoted 5 lines
system headers
Quoted 4 lines
devtools/checkpatches.sh +0
-1awk -v FOLDERS="lib drivers app examples" \ -v EXPRESSIONS='\\<__reserved\\>' \ --1.8.3.1
PATCH v2 1/1 devtools: stop compiler atomics with no C11 equivalent
In reply to Tyler RetzlaffRefrain from using compiler __atomic_{add,and,nand,or,sub,xor}_fetch() to ease future adoption of C11 standard atomics.
--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)
devtools/checkpatches.sh +8 -0
@@ -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\\>' \
Signature · 1 line
1.8.3.1
Quoted 5 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Tuesday, 4 April 2023 02.22Refrain 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:
Quoted 29 lines · Tyler Retzlaff
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 <[email protected]>--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)devtools/checkpatches.sh +8
-1@@ -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\\>' \ --
Quoted 1 line
1.8.3.1
I tweaked the warning message a bit, and applied.
Thanks.
Signature · 1 line
David Marchand