From 67399e7c314813986893c722f9b8273a5f3c78a0 Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Tue, 14 Aug 2007 17:18:15 +0000 Subject: [PATCH] Added a debug type checking for request types (to make sure request size is correctly computed). This commit was SVN r15856. --- ompi/mca/pml/v/pml_v_protocol.h | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ompi/mca/pml/v/pml_v_protocol.h b/ompi/mca/pml/v/pml_v_protocol.h index e15167b165..5034fc8fb3 100644 --- a/ompi/mca/pml/v/pml_v_protocol.h +++ b/ompi/mca/pml/v/pml_v_protocol.h @@ -49,16 +49,27 @@ typedef int (*mca_pml_v_protocol_base_component_finalize_fn_t)(void); * * @param request (IN) the address of an ompi_request * @return address of the mca_vprotocol_base_request_t associated with the request - */ -#define VPROTOCOL_REQ(req) \ + */ +#define VPROTOCOL_RECV_REQ(req) \ + (((char *) req) + mca_pml_v.host_pml_req_recv_size) +#define VPROTOCOL_SEND_REQ(req) \ + (((char *) req) + mca_pml_v.host_pml_req_send_size) +#if OMPI_ENABLE_DEBUG +#define VPROTOCOL_REQ(req) ( \ + (MCA_PML_REQUEST_SEND == ((mca_pml_base_request_t *)req)->req_type) \ + ? VPROTOCOL_SEND_REQ(req) \ + : ( \ + (MCA_PML_REQUEST_RECV == ((mca_pml_base_request_t *)req)->req_type) \ + ? VPROTOCOL_RECV_REQ(req) \ + : (V_OUTPUT("VPROTOCOL_REQ: error, request type is %d (expected %d or %d)", ((mca_pml_base_request_t *)req)->req_type, MCA_PML_REQUEST_SEND, MCA_PML_REQUEST_RECV),NULL) \ + ) \ +) +#else +#define VPROTOCOL_REQ(req) \ ((((mca_pml_base_request_t *) req)->req_type == MCA_PML_REQUEST_SEND) \ ? VPROTOCOL_SEND_REQ(req) \ : VPROTOCOL_RECV_REQ(req)) -#define VPROTOCOL_RECV_REQ(req) \ - (((char *) req) + mca_pml_v.host_pml_req_recv_size) -#define VPROTOCOL_SEND_REQ(req) \ - (((char *) req) + mca_pml_v.host_pml_req_send_size) - +#endif /** * PML_V_PROTOCOL component version and interface functions.