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:
Joel Sherrill
1996-12-02 22:50:33 +00:00
parent e1a06d1bae
commit ffe316d526
15 changed files with 41 additions and 30 deletions

View File

@@ -52,11 +52,12 @@ typedef enum {
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
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;
#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[];

View File

@@ -52,11 +52,12 @@ typedef enum {
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
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;
#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[];

View File

@@ -58,7 +58,7 @@ rtems_status_code _Event_MP_Send_request_packet (
the_packet->Prefix.id = event_id;
the_packet->event_in = event_in;
return
return (rtems_status_code)
_MPCI_Send_request_packet(
rtems_get_node( event_id ),
&the_packet->Prefix,

View File

@@ -55,7 +55,7 @@ rtems_status_code rtems_interrupt_catch(
if ( !_ISR_Is_vector_number_valid( vector ) )
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;
_ISR_Install_vector(

View File

@@ -678,7 +678,7 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
return RTEMS_TIMEOUT;
case THREAD_STATUS_PROXY_BLOCKING:
return THREAD_STATUS_PROXY_BLOCKING;
return RTEMS_PROXY_BLOCKING;
}
_Internal_error_Occurred( /* XXX */
INTERNAL_ERROR_RTEMS_API,

View File

@@ -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(
rtems_get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE);
STATES_WAITING_FOR_MESSAGE
);
break;
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_1 = size_p;
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
return (rtems_status_code) _MPCI_Send_request_packet(
rtems_get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE);
STATES_WAITING_FOR_MESSAGE
);
break;
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:

View File

@@ -360,7 +360,7 @@ rtems_status_code rtems_region_get_segment(
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
_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 */
@@ -464,7 +464,7 @@ rtems_status_code rtems_region_return_segment(
if ( the_thread == NULL )
break;
the_segment = _Region_Allocate_segment(
the_segment = (void **) _Region_Allocate_segment(
the_region,
the_thread->Wait.count
);

View File

@@ -105,7 +105,7 @@ rtems_status_code _Region_MP_Send_request_packet (
the_packet->size = size;
the_packet->option_set = option_set;
return _MPCI_Send_request_packet(
return (rtems_status_code) _MPCI_Send_request_packet(
rtems_get_node( region_id ),
&the_packet->Prefix,
STATES_READY /* Not used */

View File

@@ -52,11 +52,12 @@ typedef enum {
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
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;
#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[];

View File

@@ -58,7 +58,7 @@ rtems_status_code _Event_MP_Send_request_packet (
the_packet->Prefix.id = event_id;
the_packet->event_in = event_in;
return
return (rtems_status_code)
_MPCI_Send_request_packet(
rtems_get_node( event_id ),
&the_packet->Prefix,

View File

@@ -55,7 +55,7 @@ rtems_status_code rtems_interrupt_catch(
if ( !_ISR_Is_vector_number_valid( vector ) )
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;
_ISR_Install_vector(

View File

@@ -678,7 +678,7 @@ rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
return RTEMS_TIMEOUT;
case THREAD_STATUS_PROXY_BLOCKING:
return THREAD_STATUS_PROXY_BLOCKING;
return RTEMS_PROXY_BLOCKING;
}
_Internal_error_Occurred( /* XXX */
INTERNAL_ERROR_RTEMS_API,

View File

@@ -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(
rtems_get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE);
STATES_WAITING_FOR_MESSAGE
);
break;
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_1 = size_p;
return _MPCI_Send_request_packet(rtems_get_node(message_queue_id),
return (rtems_status_code) _MPCI_Send_request_packet(
rtems_get_node(message_queue_id),
&the_packet->Prefix,
STATES_WAITING_FOR_MESSAGE);
STATES_WAITING_FOR_MESSAGE
);
break;
case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE:

View File

@@ -360,7 +360,7 @@ rtems_status_code rtems_region_get_segment(
_Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
_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 */
@@ -464,7 +464,7 @@ rtems_status_code rtems_region_return_segment(
if ( the_thread == NULL )
break;
the_segment = _Region_Allocate_segment(
the_segment = (void **) _Region_Allocate_segment(
the_region,
the_thread->Wait.count
);

View File

@@ -105,7 +105,7 @@ rtems_status_code _Region_MP_Send_request_packet (
the_packet->size = size;
the_packet->option_set = option_set;
return _MPCI_Send_request_packet(
return (rtems_status_code) _MPCI_Send_request_packet(
rtems_get_node( region_id ),
&the_packet->Prefix,
STATES_READY /* Not used */