docs/misra: document gcc-specific behavior with shifting signed integers
PATCH 1/1 docs/misra: document gcc-specific behavior with shifting signed integers
From: Stefano Stabellini <[email protected]>
---
Changes in v2:
- use "shift" instead of << or >>
- use All Architectures (I haven't changed all the other instances of x86/arm in the file yet)
--- docs/misra/C-language-toolchain.rst | 6 ++++++ 1 file changed, 6 insertions(+)
docs/misra/C-language-toolchain.rst +6 -0
@@ -200,6 +200,12 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL + * - Signed shift acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11 + only to treat certain aspects of signed shift as undefined. + Translation Limits __________________
Signature · 1 line
2.25.1
Quoted 17 lines · Stefano Stabellini
From: Stefano Stabellini <[email protected]>
Signed-off-by Stefano Stabellini <[email protected]>---
Changes in v2:
- use "shift" instead of << or >>
- use All Architectures (I haven't changed all the other instances of x86/arm in the file yet)--- docs/misra/C-language-toolchain.rst | 6 ++++++ 1 file changed, 6 insertions(+)docs/misra/C-language-toolchain.rst +0
-0
docs/misra/C-language-toolchain.rst The table columns are as follows: · line 207
Quoted 8 lines
docs/misra/C-language-toolchain.rst +5
-0@@ -200,6 +200,12 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL + * - Signed shift acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11 + only to treat certain aspects of signed shift as undefined.
I'm sorry, but that's still not what the doc says. Replacing << and >> by "shifts" was imo wrong. What's needed instead is that either this is split into two top-level bullet points (one for << and one for >>), or the first sub-bullet-point (which acts as kind of the title) be generalized, with the << and >> details fully moved to the "explanatory" sub-bullet-point.
Jan
Quoted 21 lines · Jan Beulich
Quoted 20 lines · Stefano Stabellini
From: Stefano Stabellini <[email protected]>
Signed-off-by Stefano Stabellini <[email protected]>---
Changes in v2:
- use "shift" instead of << or >>
- use All Architectures (I haven't changed all the other instances of x86/arm in the file yet)--- docs/misra/C-language-toolchain.rst | 6 ++++++ 1 file changed, 6 insertions(+)docs/misra/C-language-toolchain.rst +0
-0@@ -200,6 +200,12 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL
Quoted 11 lines
docs/misra/C-language-toolchain.rst The table columns are as follows: · line 207
Quoted 5 lines
docs/misra/C-language-toolchain.rst +5
-0+ * - Signed shift acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11 + only to treat certain aspects of signed shift as undefined.I'm sorry, but that's still not what the doc says. Replacing << and >> by "shifts" was imo wrong. What's needed instead is that either this is split into two top-level bullet points (one for << and one for >>), or the first sub-bullet-point (which acts as kind of the title) be generalized, with the << and >> details fully moved to the "explanatory" sub-bullet-point.
I think I got your point now