Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-11.10

In this section:
Synopsis

(Required) The _Atomic qualifier shall not be applied to the incomplete type void

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

_Atomic qualifier applied to void

Coding standards
MISRA C:2012 Rule-11.10

(Required) The _Atomic qualifier shall not be applied to the incomplete type void

Code examples

The following code example fails the check and will give a warning:

struct A { 
  int _Atomic x; 
  int _Atomic y;
};

void main() {
   struct A a1 = { 6, 7 }; 
   void _Atomic * pav = &a1; /* Non-compliant */ 
   void _Atomic * pax = &a1.x; /* Non-compliant */
}

The following code example passes the check and will not give a warning about this issue:

struct A { 
  int _Atomic x; 
  int _Atomic y;
};

void main() {
   struct A a = { 6, 7 }; 
   int _Atomic * px = &a.x; /* Compliant */ 
}