Joel Sherrill created an issue: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5328

Assignee: Chris Johns

## Summary
The definition of NEEDS_THUMB_SWITCH is not portable and flagged by 
_-Wexpansion-to-defined_ which is documented as follows:

> Warn whenever ‘defined’ is encountered in the expansion of a macro (including 
> the case where the macro is expanded by an ‘#if’ directive). Such usage is 
> not portable. This warning is also enabled by -Wpedantic and -Wextra.
 
The warning is:

```
../../../cpukit/libdebugger/rtems-debugger-arm.c:85:5: warning: this use of 
'defined' may not be portable [-Wexpansion-to-defined]
   85 | #if NEEDS_THUMB_SWITCH
      |     ^~~~~~~~~~~~~~~~~~
```

This is the definition of NEEDS_THUMB_SWITCH:

`#define NEEDS_THUMB_SWITCH !ARM_THUMB_ONLY && defined(__thumb__)`

I think this needs to be restructured so NEEDS_THUMB_SWITCH is set to true or 
false directly rather than expanding to the conditional. Perhaps something like 
this with XXX and YYY replaced with 0 or 1 appropriately:

```
#if !ARM_THUMB_ONLY && defined(__thumb__)`
#define NEEDS_THUMB_SWITCH XXX
#else
#endif
#define NEEDS_THUMB_SWITCH YYY
#endif
```

## Steps to reproduce

Per the cited documentation, this is an extra warning. I am looking through 
logs with -Wextra to see what are low volume warning flags. 

### Pre-set options

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5328
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to