diff mbox series

devtools: forbid additions of __reserved

Message ID 20211023102900.22317-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series devtools: forbid additions of __reserved | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance fail Performance Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-spell-check-testing warning Testing issues
ci/checkpatch success coding style OK

Commit Message

David Marchand Oct. 23, 2021, 10:29 a.m. UTC
__reserved is a reserved keyword in Windows system headers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Bruce Richardson Oct. 27, 2021, 10 a.m. UTC | #1
On Sat, Oct 23, 2021 at 12:29:00PM +0200, David Marchand wrote:
> __reserved is a reserved keyword in Windows system headers.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Walsh, Conor Oct. 28, 2021, 1:27 p.m. UTC | #2
> From: dev <dev-bounces@dpdk.org> On Behalf Of David Marchand
> Sent: Saturday 23 October 2021 11:29
> To: dev@dpdk.org
> Cc: dmitry.kozliuk@gmail.com; Thomas Monjalon <thomas@monjalon.net>
> Subject: [dpdk-dev] [PATCH] devtools: forbid additions of __reserved
> 
> __reserved is a reserved keyword in Windows system headers.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Tested-by: Conor Walsh <conor.walsh@intel.com>
Tyler Retzlaff Nov. 11, 2021, 5:45 a.m. UTC | #3
On Sat, Oct 23, 2021 at 12:29:00PM +0200, David Marchand wrote:
> __reserved is a reserved keyword in Windows system headers.
> 

fwiw it's the c standard that stipulates identifiers starting with __
are reserved for any use.

C11/C99 "ANSI-C"
7.1.3 Reserved Identifiers
    `All identifiers that begin with an underscore and either an
    uppercase letter or another underscore are always reserved for
    any use.'

Public DPDK headers are also subject to the C++ standard.
C++ (n3690)
5.10 Identifiers

    `(3.1) -- Each identifier that contains a double underscore __ or
    begins with an underscore followed by an uppercase letter is reserved
    to the implementation for any use.'

    `(3.2) -- Each identifier that begins with an underscore is reserved
    to the implementation for use as a name in the global namespace.'

dpdk is pretty comprehensive in violating these clauses with
identifiers of the form `__rte_’ fortunately since preprocessors,
compilers, standard library headers are unlikely to use `rte’ it’s
fairly safe in spite of being non-compliant.
Thomas Monjalon Nov. 26, 2021, 5:18 p.m. UTC | #4
23/10/2021 12:29, David Marchand:
> __reserved is a reserved keyword in Windows system headers.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
[...]
> +	# refrain from using __reserved which is a reserved keyword in Windows
> +	# system headers

Reworded as "forbid"

Applied, thanks.
diff mbox series

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index c314d83a29..25f60a4a27 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -134,6 +134,15 @@  check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using __reserved which is a reserved keyword in Windows
+	# system headers
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='\\<__reserved\\>' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __reserved' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# SVG must be included with wildcard extension to allow conversion
 	awk -v FOLDERS='doc' \
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \