RTEMS | cpukit/error: Make RTEMS_ERROR_* shifts 16-bit host clean (!1069)

Gedare Bloom (@gedare) gitlab at rtems.org
Sat Feb 21 20:10:00 UTC 2026




Gedare Bloom commented on a discussion on cpukit/include/rtems/error.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1069#note_143147

 > -#define RTEMS_ERROR_ABORT  (RTEMS_ERROR_ERRNO / 4)       /* err is fatal; panic */
 > -#else
 > -#define RTEMS_ERROR_ERRNO  (0x40000000) /* hi bit; use 'errno' */
 > -#define RTEMS_ERROR_PANIC  (0x20000000) /* err fatal; no return */
 > -#define RTEMS_ERROR_ABORT  (0x10000000) /* err is fatal; panic */
 > -#endif
 > +/*
 > + * Define Error Flags
 > + */
 > +#define RTEMS_ERROR_BITS (sizeof(rtems_error_code_t) * CHAR_BIT)
 > +
 > +#define RTEMS_ERROR_ERRNO (((rtems_error_code_t)1) << (RTEMS_ERROR_BITS - 2))
 > +
 > +#define RTEMS_ERROR_PANIC (((rtems_error_code_t)1) << (RTEMS_ERROR_BITS - 3))
 > +
 > +#define RTEMS_ERROR_ABORT (((rtems_error_code_t)1) << (RTEMS_ERROR_BITS - 4))

I think the code that was previously inside of `#if 0` is easier to read than what you have written. It was also there before, so it makes sense to retain it rather than rewrite this.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1069#note_143147
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/20260221/db0530d9/attachment.htm>


More information about the bugs mailing list