title: How to call a function multiple times inside a macro in C?
body: <p>In my development environment some of the <code>ioctl</code> calls are failing on the first time, if I am calling the same <code>ioctl</code> again then it returning success.
  This is because of some hardware related time synchronization issues.</p>
  
  <p>So we are going for some temporary solution like masking all <code>ioctl</code> with one <code>MACRO</code>, inside that <code>MACRO</code> calling <code>ioctl</code> three times.</p>
  
  <p>but that <code>MACRO</code> throws compilation error. Please suggest some solution to resolve this issue.</p>
  
  <p><strong>Sample Code</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int func (int a, int b, int c)
  {
      return -1;
  }
  
  #define IOCTL_WRAPPER(a,b,c)                    \
              {                                   \
                  int i = 0, retval = 0;          \
                  while (i &lt; 3)                   \
                  {                               \
                      retval = func (a, b, c);    \
                      if (retval != -1)           \
                      {                           \
                          break;                  \
                      }                           \
                      i++;                        \
                  }                               \
                  retval;                         \
              }
  
  int main ()
  {
      int RetVal = 0;
  
      RetVal = IOCTL_WRAPPER(1, 2, 3);
  
      if (RetVal != -1)
      {
          printf ("\n pass \n");
      }
      else
      {
          printf ("\n fail \n");
      }
  
      return 0;
  }
  </code></pre>
  
  <p><strong>Compilation Error</strong></p>
  
  <pre><code>a.c: In function âmainâ:
  a.c:9:13: error: expected expression before â{â token
               {                                   \
               ^
  a.c:27:14: note: in expansion of macro âIOCTL_WRAPPERâ
       RetVal = IOCTL_WRAPPER(1, 2, 3);
            ^
  </code></pre>