forked from Imagelibrary/rtems
Suggested changes from Mark Jordan which eliminate warnings and errors
he received using the Microtec C++ compiler. Most of these are either missing casts from/to (void *), heavy handed use of enumerated types, or simply assumed conversions. There is at least one actual bug in an error path in thread.c in which the wrong argument was passed to _Thread_Stack_Free and was not being caught by gcc.
This commit is contained in:
@@ -52,11 +52,12 @@ typedef enum {
|
|||||||
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
||||||
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
||||||
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
||||||
RTEMS_NO_MEMORY = 26 /* could not get enough memory */
|
RTEMS_NO_MEMORY = 26, /* could not get enough memory */
|
||||||
|
RTEMS_PROXY_BLOCKING = 27 /* internal error only */
|
||||||
} rtems_status_code;
|
} rtems_status_code;
|
||||||
|
|
||||||
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
||||||
#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
|
#define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING
|
||||||
|
|
||||||
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,12 @@ typedef enum {
|
|||||||
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
||||||
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
||||||
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
||||||
RTEMS_NO_MEMORY = 26 /* could not get enough memory */
|
RTEMS_NO_MEMORY = 26, /* could not get enough memory */
|
||||||
|
RTEMS_PROXY_BLOCKING = 27 /* internal error only */
|
||||||
} rtems_status_code;
|
} rtems_status_code;
|
||||||
|
|
||||||
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
||||||
#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
|
#define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING
|
||||||
|
|
||||||
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ rtems_status_code _Event_MP_Send_request_packet (
|
|||||||
the_packet->Prefix.id = event_id;
|
the_packet->Prefix.id = event_id;
|
||||||
the_packet->event_in = event_in;
|
the_packet->event_in = event_in;
|
||||||
|
|
||||||
return
|
return (rtems_status_code)
|
||||||
_MPCI_Send_request_packet(
|
_MPCI_Send_request_packet(
|
||||||
rtems_get_node( event_id ),
|
rtems_get_node( event_id ),
|
||||||
&the_packet->Prefix,
|
&the_packet->Prefix,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ rtems_status_code rtems_interrupt_catch(
|
|||||||
if ( !_ISR_Is_vector_number_valid( vector ) )
|
if ( !_ISR_Is_vector_number_valid( vector ) )
|
||||||
return RTEMS_INVALID_NUMBER;
|
return RTEMS_INVALID_NUMBER;
|
||||||
|
|
||||||
if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
|
if ( !_ISR_Is_valid_user_handler( (void *) new_isr_handler ) )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
_ISR_Install_vector(
|
_ISR_Install_vector(
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
|
|||||||
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
||||||
return RTEMS_TIMEOUT;
|
return RTEMS_TIMEOUT;
|
||||||
case THREAD_STATUS_PROXY_BLOCKING:
|
case THREAD_STATUS_PROXY_BLOCKING:
|
||||||
return THREAD_STATUS_PROXY_BLOCKING;
|
return RTEMS_PROXY_BLOCKING;
|
||||||
}
|
}
|
||||||
_Internal_error_Occurred( /* XXX */
|
_Internal_error_Occurred( /* XXX */
|
||||||
INTERNAL_ERROR_RTEMS_API,
|
INTERNAL_ERROR_RTEMS_API,
|
||||||
|
|||||||
@@ -140,9 +140,11 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
&the_packet->Prefix,
|
rtems_get_node(message_queue_id),
|
||||||
STATES_WAITING_FOR_MESSAGE);
|
&the_packet->Prefix,
|
||||||
|
STATES_WAITING_FOR_MESSAGE
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
|
case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
|
||||||
@@ -163,9 +165,11 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
|
|||||||
_Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
|
_Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
|
||||||
_Thread_Executing->Wait.return_argument_1 = size_p;
|
_Thread_Executing->Wait.return_argument_1 = size_p;
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
&the_packet->Prefix,
|
rtems_get_node(message_queue_id),
|
||||||
STATES_WAITING_FOR_MESSAGE);
|
&the_packet->Prefix,
|
||||||
|
STATES_WAITING_FOR_MESSAGE
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
|
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return( executing->Wait.return_code );
|
return (rtems_status_code) executing->Wait.return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
|
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
|
||||||
@@ -464,7 +464,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
if ( the_thread == NULL )
|
if ( the_thread == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
the_segment = _Region_Allocate_segment(
|
the_segment = (void **) _Region_Allocate_segment(
|
||||||
the_region,
|
the_region,
|
||||||
the_thread->Wait.count
|
the_thread->Wait.count
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ rtems_status_code _Region_MP_Send_request_packet (
|
|||||||
the_packet->size = size;
|
the_packet->size = size;
|
||||||
the_packet->option_set = option_set;
|
the_packet->option_set = option_set;
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
rtems_get_node( region_id ),
|
rtems_get_node( region_id ),
|
||||||
&the_packet->Prefix,
|
&the_packet->Prefix,
|
||||||
STATES_READY /* Not used */
|
STATES_READY /* Not used */
|
||||||
|
|||||||
@@ -52,11 +52,12 @@ typedef enum {
|
|||||||
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
||||||
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
||||||
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
||||||
RTEMS_NO_MEMORY = 26 /* could not get enough memory */
|
RTEMS_NO_MEMORY = 26, /* could not get enough memory */
|
||||||
|
RTEMS_PROXY_BLOCKING = 27 /* internal error only */
|
||||||
} rtems_status_code;
|
} rtems_status_code;
|
||||||
|
|
||||||
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
||||||
#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
|
#define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING
|
||||||
|
|
||||||
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ rtems_status_code _Event_MP_Send_request_packet (
|
|||||||
the_packet->Prefix.id = event_id;
|
the_packet->Prefix.id = event_id;
|
||||||
the_packet->event_in = event_in;
|
the_packet->event_in = event_in;
|
||||||
|
|
||||||
return
|
return (rtems_status_code)
|
||||||
_MPCI_Send_request_packet(
|
_MPCI_Send_request_packet(
|
||||||
rtems_get_node( event_id ),
|
rtems_get_node( event_id ),
|
||||||
&the_packet->Prefix,
|
&the_packet->Prefix,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ rtems_status_code rtems_interrupt_catch(
|
|||||||
if ( !_ISR_Is_vector_number_valid( vector ) )
|
if ( !_ISR_Is_vector_number_valid( vector ) )
|
||||||
return RTEMS_INVALID_NUMBER;
|
return RTEMS_INVALID_NUMBER;
|
||||||
|
|
||||||
if ( !_ISR_Is_valid_user_handler( new_isr_handler ) )
|
if ( !_ISR_Is_valid_user_handler( (void *) new_isr_handler ) )
|
||||||
return RTEMS_INVALID_ADDRESS;
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
|
||||||
_ISR_Install_vector(
|
_ISR_Install_vector(
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
|
|||||||
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
||||||
return RTEMS_TIMEOUT;
|
return RTEMS_TIMEOUT;
|
||||||
case THREAD_STATUS_PROXY_BLOCKING:
|
case THREAD_STATUS_PROXY_BLOCKING:
|
||||||
return THREAD_STATUS_PROXY_BLOCKING;
|
return RTEMS_PROXY_BLOCKING;
|
||||||
}
|
}
|
||||||
_Internal_error_Occurred( /* XXX */
|
_Internal_error_Occurred( /* XXX */
|
||||||
INTERNAL_ERROR_RTEMS_API,
|
INTERNAL_ERROR_RTEMS_API,
|
||||||
|
|||||||
@@ -140,9 +140,11 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
&the_packet->Prefix,
|
rtems_get_node(message_queue_id),
|
||||||
STATES_WAITING_FOR_MESSAGE);
|
&the_packet->Prefix,
|
||||||
|
STATES_WAITING_FOR_MESSAGE
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
|
case MESSAGE_QUEUE_MP_RECEIVE_REQUEST:
|
||||||
@@ -163,9 +165,11 @@ rtems_status_code _Message_queue_MP_Send_request_packet (
|
|||||||
_Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
|
_Thread_Executing->Wait.return_argument = (unsigned32 *)buffer;
|
||||||
_Thread_Executing->Wait.return_argument_1 = size_p;
|
_Thread_Executing->Wait.return_argument_1 = size_p;
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
&the_packet->Prefix,
|
rtems_get_node(message_queue_id),
|
||||||
STATES_WAITING_FOR_MESSAGE);
|
&the_packet->Prefix,
|
||||||
|
STATES_WAITING_FOR_MESSAGE
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
|
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ rtems_status_code rtems_region_get_segment(
|
|||||||
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return( executing->Wait.return_code );
|
return (rtems_status_code) executing->Wait.return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
|
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
|
||||||
@@ -464,7 +464,7 @@ rtems_status_code rtems_region_return_segment(
|
|||||||
if ( the_thread == NULL )
|
if ( the_thread == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
the_segment = _Region_Allocate_segment(
|
the_segment = (void **) _Region_Allocate_segment(
|
||||||
the_region,
|
the_region,
|
||||||
the_thread->Wait.count
|
the_thread->Wait.count
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ rtems_status_code _Region_MP_Send_request_packet (
|
|||||||
the_packet->size = size;
|
the_packet->size = size;
|
||||||
the_packet->option_set = option_set;
|
the_packet->option_set = option_set;
|
||||||
|
|
||||||
return _MPCI_Send_request_packet(
|
return (rtems_status_code) _MPCI_Send_request_packet(
|
||||||
rtems_get_node( region_id ),
|
rtems_get_node( region_id ),
|
||||||
&the_packet->Prefix,
|
&the_packet->Prefix,
|
||||||
STATES_READY /* Not used */
|
STATES_READY /* Not used */
|
||||||
|
|||||||
Reference in New Issue
Block a user