[PATCH 7/8] rtems: Remove Message_queue_Control::attribute_set

Gedare Bloom gedare at rtems.org
Fri Sep 25 16:46:33 UTC 2020


On Fri, Sep 25, 2020 at 10:21 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> On 25/09/2020 17:42, Joel Sherrill wrote:
>
> >     diff --git a/cpukit/libmisc/monitor/mon-queue.c
> >     b/cpukit/libmisc/monitor/mon-queue.c
> >     index 9430797c6c..aadfcd3989 100644
> >     --- a/cpukit/libmisc/monitor/mon-queue.c
> >     +++ b/cpukit/libmisc/monitor/mon-queue.c
> >     @@ -16,7 +16,21 @@ rtems_monitor_queue_canonical(
> >      {
> >          const Message_queue_Control *rtems_queue = (const
> >     Message_queue_Control *) queue_void;
> >
> >     -    canonical_queue->attributes = rtems_queue->attribute_set;
> >     +    canonical_queue->attributes = 0;
> >     +
> >     +    if (
> >     +      rtems_queue->message_queue.operations
> >     +        == &_Thread_queue_Operations_priority
> >     +    ) {
> >
> >
> > Why the odd formatting on this? I would think it should be:
> >    if ( rtems_queue->message_queue.operations ==
> >           &_Thread_queue_Operations_priority ) {
> With this style it is not really clear what belongs to the condition and
> what to the next code block. The ") {" in a separate line makes this
> more clear.
>
The formatting from Sebastian is correct/acceptable. We don't exactly
specify whether the == should go on the same line or separate. But if
you break a conditional, it is supposed to be throughout the whole
thing like that
if (
  ... first line
  ...
  ... last line
) {

> I used this style all over the place for a couple of years.
> Unfortunately, this area is not covered by the coding conventions:
>
> https://docs.rtems.org/branches/master/eng/coding-conventions.html#formatting
>
Yes, I think this came up recently about whether to put the
(in)equality check on the same or next line. Either way seems to be
ok. We don't have an example to cover this choice:
https://docs.rtems.org/branches/master/eng/coding-80cols.html

> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list