* [PATCH v2] misra: add R21.1 R21.2
@ 2023-11-14 22:59 Stefano Stabellini
2023-11-15 8:00 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2023-11-14 22:59 UTC (permalink / raw)
To: xen-devel
Cc: sstabellini, Jan Beulich, Andrew Cooper, Roger Pau Monné,
Bertrand Marquis, Julien Grall
Add 21.1 and 21.2, with a longer comment to explain how strategy with
leading underscores and why we think we are safe today.
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v2:
- remove R14.4
- update note section of 21.1
---
docs/misra/rules.rst | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index da343ab3ac..375a886607 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -519,6 +519,28 @@ maintainers if you want to suggest a change.
they are related
-
+ * - `Rule 21.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_01.c>`_
+ - Required
+ - #define and #undef shall not be used on a reserved identifier or
+ reserved macro name
+ - Identifiers starting with an underscore followed by another underscore
+ or an upper-case letter are reserved. Today Xen uses many, such as
+ header guards and bitwise manipulation functions. Upon analysis it turns
+ out Xen identifiers do not clash with the identifiers used by modern
+ GCC, but that is not a guarantee that there won't be a naming clash in
+ the future or with another compiler. For these reasons we discourage
+ the introduction of new reserved identifiers in Xen, and we see it as
+ positive the reduction of reserved identifiers. At the same time,
+ certain identifiers starting with an underscore are also commonly used
+ in Linux (e.g. __set_bit) and we don't think it would be an improvement
+ to rename them.
+
+ * - `Rule 21.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_02.c>`_
+ - Required
+ - A reserved identifier or reserved macro name shall not be
+ declared
+ - See comment for Rule 21.1
+
* - `Rule 21.13 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_13.c>`_
- Mandatory
- Any value passed to a function in <ctype.h> shall be representable as an
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] misra: add R21.1 R21.2
2023-11-14 22:59 [PATCH v2] misra: add R21.1 R21.2 Stefano Stabellini
@ 2023-11-15 8:00 ` Jan Beulich
2023-11-16 0:03 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-11-15 8:00 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Andrew Cooper, Roger Pau Monné, Bertrand Marquis,
Julien Grall, xen-devel
On 14.11.2023 23:59, Stefano Stabellini wrote:
> Add 21.1 and 21.2, with a longer comment to explain how strategy with
> leading underscores and why we think we are safe today.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
with one nit:
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -519,6 +519,28 @@ maintainers if you want to suggest a change.
> they are related
> -
>
> + * - `Rule 21.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_01.c>`_
> + - Required
> + - #define and #undef shall not be used on a reserved identifier or
> + reserved macro name
> + - Identifiers starting with an underscore followed by another underscore
> + or an upper-case letter are reserved. Today Xen uses many, such as
> + header guards and bitwise manipulation functions. Upon analysis it turns
> + out Xen identifiers do not clash with the identifiers used by modern
> + GCC, but that is not a guarantee that there won't be a naming clash in
> + the future or with another compiler. For these reasons we discourage
> + the introduction of new reserved identifiers in Xen, and we see it as
> + positive the reduction of reserved identifiers. At the same time,
> + certain identifiers starting with an underscore are also commonly used
> + in Linux (e.g. __set_bit) and we don't think it would be an improvement
> + to rename them.
I think this last sentence would also better say "two underscores".
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] misra: add R21.1 R21.2
2023-11-15 8:00 ` Jan Beulich
@ 2023-11-16 0:03 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2023-11-16 0:03 UTC (permalink / raw)
To: Jan Beulich
Cc: Stefano Stabellini, Andrew Cooper, Roger Pau Monné,
Bertrand Marquis, Julien Grall, xen-devel
On Wed, 15 Nov 2023, Jan Beulich wrote:
> On 14.11.2023 23:59, Stefano Stabellini wrote:
> > Add 21.1 and 21.2, with a longer comment to explain how strategy with
> > leading underscores and why we think we are safe today.
> >
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> with one nit:
>
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -519,6 +519,28 @@ maintainers if you want to suggest a change.
> > they are related
> > -
> >
> > + * - `Rule 21.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_01.c>`_
> > + - Required
> > + - #define and #undef shall not be used on a reserved identifier or
> > + reserved macro name
> > + - Identifiers starting with an underscore followed by another underscore
> > + or an upper-case letter are reserved. Today Xen uses many, such as
> > + header guards and bitwise manipulation functions. Upon analysis it turns
> > + out Xen identifiers do not clash with the identifiers used by modern
> > + GCC, but that is not a guarantee that there won't be a naming clash in
> > + the future or with another compiler. For these reasons we discourage
> > + the introduction of new reserved identifiers in Xen, and we see it as
> > + positive the reduction of reserved identifiers. At the same time,
> > + certain identifiers starting with an underscore are also commonly used
> > + in Linux (e.g. __set_bit) and we don't think it would be an improvement
> > + to rename them.
>
> I think this last sentence would also better say "two underscores".
Done on commit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-16 0:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 22:59 [PATCH v2] misra: add R21.1 R21.2 Stefano Stabellini
2023-11-15 8:00 ` Jan Beulich
2023-11-16 0:03 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.