acassis commented on code in PR #8707:
URL: https://github.com/apache/nuttx/pull/8707#discussion_r1125562624


##########
arch/arm/src/imx6/imx_gpio.c:
##########
@@ -542,16 +544,25 @@ int imx_config_gpio(gpio_pinset_t pinset)
         }
         break;
 
-      case GPIO_PERIPH:
-        {
-          /* Configure the pin as a peripheral */
-
-          ret = imx_gpio_configperiph(pinset);
-        }
-        break;
-
       default:
-        ret = -EINVAL;
+
+        /* Workaround for:
+         * chip/imx_gpio.c:545:7: error: case label does not reduce to an
+         *   integer constant
+         *    545 |       case GPIO_PERIPH:
+         *        |       ^~~~
+         */
+
+        if (pinset == GPIO_PERIPH)

Review Comment:
   Normally this message is displayed when someone use a variable instead of a 
constant: 
https://www.includehelp.com/c-programs/case-label-does-not-reduce-to-an-integer-constant-error-in-c.aspx
   
   This error shouldn't happen when using GPIO_PERIPH.
   
   @no1wudi did you try replacing "case GPIO_PERIPH" with "case  (2 << 30)" 
just to confirm that the issue could be related to the signal bit?
   
   Hmm, interesting test:
   
   ```
     const int c = 1;
   
     case c:
       printf("case c\n"); break;
   ```
   
   clang accepts it, but gcc (11.3.0) raises an error:
   
   ```
   testcase.c:12:9: error: case label does not reduce to an integer constant
      12 |         case c:     //no compile error for clang
         |         ^~~~
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to