RTEMS | sparc/cpuimpl.h: (#5226)

Joel Sherrill (@joel) gitlab at rtems.org
Mon Mar 3 20:14:56 UTC 2025



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



## Summary

The test spstdc17 produces this warning on SPARC/Leon3

```
[4255/4751] Compiling testsuites/sptests/spsyslock01/init.c
In file included from ../../../cpukit/include/rtems/score/percpu.h:43,
                 from ../../../cpukit/include/rtems/score/threaddispatch.h:41,
                 from ../../../testsuites/support/include/tmacros.h:50,
                 from ../../../testsuites/sptests/spstdc17/init.c:34:
../../../cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h:220:17: warning: file-scope declaration of '_SPARC_Per_CPU_current' specifies 'register' [-Wpedantic]
  220 | register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__( "g6" );
      |                 ^~~~~~~~~~~~~~~
```

I am not sure why GCC waited until C17 to complain about this but [CPP reference](https://en.cppreference.com/w/c/language/storage_duration) states that it is block scoped. This would imply the file scope declaration is an issue.

This warning could be disabled around this code for >= C17 easily enough but we need to understand if this has ramifications.


## Steps to reproduce


### Pre-set options

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250303/e821e1bc/attachment.htm>


More information about the bugs mailing list