Changeset 1d39e96 in rtems


Ignore:
Timestamp:
Oct 5, 2018, 6:11:09 AM (7 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4a7c6867
Parents:
51b3cbca
git-author:
Sebastian Huber <sebastian.huber@…> (10/05/18 06:11:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/05/18 11:41:07)
Message:

score: Fix legacy RTEMS_STATIC_ASSERT()

In standard C pointer operands are not allowed in integer constant
expressions. Avoid a static assertion based on an array typedef since
this could lead to warnings ("variably modified 'x' at file scope" and
"typedef 'x' locally defined but not used");

This implementation requires unique messages.

Location:
cpukit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/score/basedefs.h

    r51b3cbca r1d39e96  
    318318#else
    319319  #define RTEMS_STATIC_ASSERT(cond, msg) \
    320     typedef int rtems_static_assert_ ## msg [(cond) ? 1 : -1]
     320    struct rtems_static_assert_ ## msg \
     321      { int rtems_static_assert_ ## msg : (cond) ? 1 : -1; }
    321322#endif
    322323
  • cpukit/include/rtems/score/threadqimpl.h

    r51b3cbca r1d39e96  
    12081208} Thread_queue_Object;
    12091209
    1210 #define THREAD_QUEUE_OBJECT_ASSERT( object_type, wait_queue_member ) \
     1210#define THREAD_QUEUE_OBJECT_ASSERT( object_type, wait_queue_member, msg ) \
    12111211  RTEMS_STATIC_ASSERT( \
    12121212    offsetof( object_type, wait_queue_member ) \
     
    12181218      Wait_queue \
    12191219    ), \
    1220     object_type \
     1220    msg \
    12211221  )
    12221222
  • cpukit/posix/src/mqueuerecvsupp.c

    r51b3cbca r1d39e96  
    2626THREAD_QUEUE_OBJECT_ASSERT(
    2727  POSIX_Message_queue_Control,
    28   Message_queue.Wait_queue
     28  Message_queue.Wait_queue,
     29  POSIX_MESSAGE_QUEUE_CONTROL
    2930);
    3031
  • cpukit/posix/src/mutexinit.c

    r51b3cbca r1d39e96  
    4141  offsetof( POSIX_Mutex_Control, Priority_ceiling )
    4242    == offsetof( pthread_mutex_t, _Priority_ceiling ),
    43   POSIX_MUTEX_CONTROL_SCHEDULER
     43  POSIX_MUTEX_CONTROL_PRIORITY_CEILING
    4444);
    4545
  • cpukit/rtems/src/barrierwait.c

    r51b3cbca r1d39e96  
    2222#include <rtems/rtems/statusimpl.h>
    2323
    24 THREAD_QUEUE_OBJECT_ASSERT( Barrier_Control, Barrier.Wait_queue );
     24THREAD_QUEUE_OBJECT_ASSERT(
     25  Barrier_Control,
     26  Barrier.Wait_queue,
     27  BARRIER_CONTROL
     28);
    2529
    2630rtems_status_code rtems_barrier_wait(
  • cpukit/rtems/src/msgqreceive.c

    r51b3cbca r1d39e96  
    2323#include <rtems/rtems/statusimpl.h>
    2424
    25 THREAD_QUEUE_OBJECT_ASSERT( Message_queue_Control, message_queue.Wait_queue );
     25THREAD_QUEUE_OBJECT_ASSERT(
     26  Message_queue_Control,
     27  message_queue.Wait_queue,
     28  MESSAGE_QUEUE_CONTROL
     29);
    2630
    2731rtems_status_code rtems_message_queue_receive(
  • cpukit/rtems/src/semobtain.c

    r51b3cbca r1d39e96  
    2525THREAD_QUEUE_OBJECT_ASSERT(
    2626  Semaphore_Control,
    27   Core_control.Wait_queue
     27  Core_control.Wait_queue,
     28  SEMAPHORE_CONTROL_GENERIC
    2829);
    2930
    3031THREAD_QUEUE_OBJECT_ASSERT(
    3132  Semaphore_Control,
    32   Core_control.Mutex.Recursive.Mutex.Wait_queue
     33  Core_control.Mutex.Recursive.Mutex.Wait_queue,
     34  SEMAPHORE_CONTROL_MUTEX
    3335);
    3436
    3537THREAD_QUEUE_OBJECT_ASSERT(
    3638  Semaphore_Control,
    37   Core_control.Semaphore.Wait_queue
     39  Core_control.Semaphore.Wait_queue,
     40  SEMAPHORE_CONTROL_SEMAPHORE
    3841);
    3942
     
    4144THREAD_QUEUE_OBJECT_ASSERT(
    4245  Semaphore_Control,
    43   Core_control.MRSP.Wait_queue
     46  Core_control.MRSP.Wait_queue,
     47  SEMAPHORE_CONTROL_MRSP
    4448);
    4549#endif
Note: See TracChangeset for help on using the changeset viewer.