From 15e20854c41119eb6c28a5c60eee7df325ad20de Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 26 Apr 2019 17:01:57 +0200 Subject: [PATCH] some forgotten consts --- include/smpi/smpi.h | 16 ++++++++-------- src/smpi/bindings/smpi_mpi.cpp | 16 ++++++++-------- src/smpi/bindings/smpi_pmpi.cpp | 6 +++--- src/smpi/bindings/smpi_pmpi_comm.cpp | 2 +- src/smpi/bindings/smpi_pmpi_type.cpp | 2 +- src/smpi/include/smpi_comm.hpp | 2 +- src/smpi/include/smpi_datatype.hpp | 2 +- src/smpi/include/smpi_status.hpp | 2 +- src/smpi/mpi/smpi_comm.cpp | 2 +- src/smpi/mpi/smpi_datatype.cpp | 2 +- src/smpi/mpi/smpi_status.cpp | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index fb6259b880..4fb2272709 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -418,7 +418,7 @@ MPI_CALL(XBT_PUBLIC double, MPI_Wtime, (void)); MPI_CALL(XBT_PUBLIC double, MPI_Wtick, (void)); MPI_CALL(XBT_PUBLIC int, MPI_Address, (void* location, MPI_Aint* address)); -MPI_CALL(XBT_PUBLIC int, MPI_Get_address, (void* location, MPI_Aint* address)); +MPI_CALL(XBT_PUBLIC int, MPI_Get_address, (const void* location, MPI_Aint* address)); MPI_CALL(XBT_PUBLIC int, MPI_Error_class, (int errorcode, int* errorclass)); MPI_CALL(XBT_PUBLIC int, MPI_Attr_delete, (MPI_Comm comm, int keyval)); @@ -464,7 +464,7 @@ MPI_CALL(XBT_PUBLIC int, MPI_Type_create_resized, (MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype* newtype)); MPI_CALL(XBT_PUBLIC MPI_Datatype, MPI_Type_f2c, (MPI_Fint datatype)); MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Type_c2f, (MPI_Datatype datatype)); -MPI_CALL(XBT_PUBLIC int, MPI_Get_count, (MPI_Status * status, MPI_Datatype datatype, int* count)); +MPI_CALL(XBT_PUBLIC int, MPI_Get_count, (const MPI_Status * status, MPI_Datatype datatype, int* count)); MPI_CALL(XBT_PUBLIC int, MPI_Type_get_attr, (MPI_Datatype type, int type_keyval, void* attribute_val, int* flag)); MPI_CALL(XBT_PUBLIC int, MPI_Type_set_attr, (MPI_Datatype type, int type_keyval, void* att)); MPI_CALL(XBT_PUBLIC int, MPI_Type_delete_attr, (MPI_Datatype type, int comm_keyval)); @@ -473,7 +473,7 @@ MPI_CALL(XBT_PUBLIC int, MPI_Type_create_keyval, void* extra_state)); MPI_CALL(XBT_PUBLIC int, MPI_Type_free_keyval, (int* keyval)); MPI_CALL(XBT_PUBLIC int, MPI_Type_dup, (MPI_Datatype datatype, MPI_Datatype* newtype)); -MPI_CALL(XBT_PUBLIC int, MPI_Type_set_name, (MPI_Datatype datatype, char* name)); +MPI_CALL(XBT_PUBLIC int, MPI_Type_set_name, (MPI_Datatype datatype, const char* name)); MPI_CALL(XBT_PUBLIC int, MPI_Type_get_name, (MPI_Datatype datatype, char* name, int* len)); MPI_CALL(XBT_PUBLIC int, MPI_Pack, @@ -507,7 +507,7 @@ MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Group_c2f, (MPI_Group group)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_rank, (MPI_Comm comm, int* rank)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_size, (MPI_Comm comm, int* size)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_name, (MPI_Comm comm, char* name, int* len)); -MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_name, (MPI_Comm comm, char* name)); +MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_name, (MPI_Comm comm, const char* name)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_dup, (MPI_Comm comm, MPI_Comm* newcomm)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_attr, (MPI_Comm comm, int comm_keyval, void* attribute_val, int* flag)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_attr, (MPI_Comm comm, int comm_keyval, void* attribute_val)); @@ -850,15 +850,15 @@ MPI_CALL(XBT_PUBLIC int, MPI_Comm_dup_with_info, (MPI_Comm comm, MPI_Info info, MPI_CALL(XBT_PUBLIC int, MPI_Comm_split_type, (MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm* newcomm)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_connect, - (char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm)); + (const char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm)); MPI_CALL(XBT_PUBLIC int, MPI_Unpublish_name, (char* service_name, MPI_Info info, char* port_name)); MPI_CALL(XBT_PUBLIC int, MPI_Publish_name, (char* service_name, MPI_Info info, char* port_name)); MPI_CALL(XBT_PUBLIC int, MPI_Lookup_name, (char* service_name, MPI_Info info, char* port_name)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_join, (int fd, MPI_Comm* intercomm)); MPI_CALL(XBT_PUBLIC int, MPI_Open_port, (MPI_Info info, char* port_name)); -MPI_CALL(XBT_PUBLIC int, MPI_Close_port, (char* port_name)); -MPI_CALL(XBT_PUBLIC int, MPI_Comm_accept, (char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm)); -MPI_CALL(XBT_PUBLIC int, MPI_Comm_spawn, (char* command, char** argv, int maxprocs, MPI_Info info, int root, +MPI_CALL(XBT_PUBLIC int, MPI_Close_port, (const char* port_name)); +MPI_CALL(XBT_PUBLIC int, MPI_Comm_accept, (const char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm)); +MPI_CALL(XBT_PUBLIC int, MPI_Comm_spawn, (const char* command, char** argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* intercomm, int* array_of_errcodes)); MPI_CALL(XBT_PUBLIC int, MPI_Comm_spawn_multiple, (int count, char** array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info, diff --git a/src/smpi/bindings/smpi_mpi.cpp b/src/smpi/bindings/smpi_mpi.cpp index 958060da6b..9debaab885 100644 --- a/src/smpi/bindings/smpi_mpi.cpp +++ b/src/smpi/bindings/smpi_mpi.cpp @@ -104,7 +104,7 @@ WRAPPED_PMPI_CALL(int,MPI_Comm_free,(MPI_Comm * comm),(comm)) WRAPPED_PMPI_CALL(int,MPI_Comm_get_attr ,(MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag),(comm, comm_keyval, attribute_val, flag)) WRAPPED_PMPI_CALL(int,MPI_Comm_get_info ,(MPI_Comm comm, MPI_Info* info),(comm, info)) WRAPPED_PMPI_CALL(int,MPI_Comm_get_name ,(MPI_Comm comm, char* name, int* len),(comm, name, len)) -WRAPPED_PMPI_CALL(int,MPI_Comm_set_name ,(MPI_Comm comm, char* name),(comm, name)) +WRAPPED_PMPI_CALL(int,MPI_Comm_set_name ,(MPI_Comm comm, const char* name),(comm, name)) WRAPPED_PMPI_CALL(int,MPI_Comm_group,(MPI_Comm comm, MPI_Group * group),(comm, group)) WRAPPED_PMPI_CALL(int,MPI_Comm_rank,(MPI_Comm comm, int *rank),(comm, rank)) WRAPPED_PMPI_CALL(int,MPI_Comm_set_attr ,(MPI_Comm comm, int comm_keyval, void *attribute_val),( comm, comm_keyval, attribute_val)) @@ -124,8 +124,8 @@ WRAPPED_PMPI_CALL(int,MPI_Finalize,(void),()) WRAPPED_PMPI_CALL(int,MPI_Free_mem,(void *baseptr),(baseptr)) WRAPPED_PMPI_CALL(int,MPI_Gather,(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm),(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm)) WRAPPED_PMPI_CALL(int,MPI_Gatherv,(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *displs,MPI_Datatype recvtype, int root, MPI_Comm comm),(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm)) -WRAPPED_PMPI_CALL(int,MPI_Get_address,(void *location, MPI_Aint * address),(location, address)) -WRAPPED_PMPI_CALL(int,MPI_Get_count,(MPI_Status * status, MPI_Datatype datatype, int *count),(status, datatype, count)) +WRAPPED_PMPI_CALL(int,MPI_Get_address,(const void *location, MPI_Aint * address),(location, address)) +WRAPPED_PMPI_CALL(int,MPI_Get_count,(const MPI_Status * status, MPI_Datatype datatype, int *count),(status, datatype, count)) WRAPPED_PMPI_CALL(int,MPI_Get_library_version ,(char *version,int *len),(version,len)) WRAPPED_PMPI_CALL(int,MPI_Get_processor_name,(char *name, int *resultlen),(name, resultlen)) WRAPPED_PMPI_CALL(int,MPI_Get_version ,(int *version,int *subversion),(version,subversion)) @@ -244,7 +244,7 @@ WRAPPED_PMPI_CALL(int,MPI_Type_hvector,(int count, int blocklen, MPI_Aint stride WRAPPED_PMPI_CALL(int,MPI_Type_indexed,(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype)) WRAPPED_PMPI_CALL(int,MPI_Type_lb,(MPI_Datatype datatype, MPI_Aint * disp),(datatype, disp)) WRAPPED_PMPI_CALL(int,MPI_Type_set_attr ,(MPI_Datatype type, int type_keyval, void *attribute_val),( type, type_keyval, attribute_val)) -WRAPPED_PMPI_CALL(int,MPI_Type_set_name,(MPI_Datatype datatype, char * name),(datatype, name)) +WRAPPED_PMPI_CALL(int,MPI_Type_set_name,(MPI_Datatype datatype, const char * name),(datatype, name)) WRAPPED_PMPI_CALL(int,MPI_Type_size,(MPI_Datatype datatype, int *size),(datatype, size)) WRAPPED_PMPI_CALL(int,MPI_Type_size_x,(MPI_Datatype datatype, MPI_Count *size),(datatype, size)) WRAPPED_PMPI_CALL(int,MPI_Type_struct,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype)) @@ -346,10 +346,10 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Bsend,(const void* buf, int count, MPI_D UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Buffer_attach,(void* buffer, int size) ,(buffer, size)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Buffer_detach,(void* buffer, int* size) ,(buffer, size)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Cart_map,(MPI_Comm comm_old, int ndims, const int* dims, const int* periods, int* newrank) ,(comm_old, ndims, dims, periods, newrank)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Close_port,( char *port_name),( port_name)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_accept,( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm)) +UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Close_port,(const char *port_name),( port_name)) +UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_accept,(const char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_call_errhandler,(MPI_Comm comm,int errorcode),(comm, errorcode)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_connect,( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm)) +UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_connect,(const char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler),( function, errhandler)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_dup_with_info,(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm),(comm,info,newcomm)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_get_errhandler,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler)) @@ -358,7 +358,7 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_join,( int fd, MPI_Comm *intercomm) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_group,(MPI_Comm comm, MPI_Group* group) ,(comm, group)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_size,(MPI_Comm comm, int* size) ,(comm, size)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_errhandler,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn,( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes),( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes)) +UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn,(const char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes),( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn_multiple,(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes), (count, array_of_commands, array_of_argv, array_of_maxprocs, array_of_info, root, comm, intercomm, array_of_errcodes)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_test_inter,(MPI_Comm comm, int* flag) ,(comm, flag)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Errhandler_create,(MPI_Handler_function* function, MPI_Errhandler* errhandler) ,(function, errhandler)) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index 1f3ec5815d..cbddb4d588 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -152,9 +152,9 @@ int PMPI_Address(void *location, MPI_Aint * address) } } -int PMPI_Get_address(void *location, MPI_Aint * address) +int PMPI_Get_address(const void *location, MPI_Aint * address) { - return PMPI_Address(location, address); + return PMPI_Address(const_cast(location), address); } int PMPI_Get_processor_name(char *name, int *resultlen) @@ -167,7 +167,7 @@ int PMPI_Get_processor_name(char *name, int *resultlen) return MPI_SUCCESS; } -int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count) +int PMPI_Get_count(const MPI_Status * status, MPI_Datatype datatype, int *count) { if (status == nullptr || count == nullptr) { return MPI_ERR_ARG; diff --git a/src/smpi/bindings/smpi_pmpi_comm.cpp b/src/smpi/bindings/smpi_pmpi_comm.cpp index 204207d6fd..d8d4be3f47 100644 --- a/src/smpi/bindings/smpi_pmpi_comm.cpp +++ b/src/smpi/bindings/smpi_pmpi_comm.cpp @@ -49,7 +49,7 @@ int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len) } } -int PMPI_Comm_set_name (MPI_Comm comm, char* name) +int PMPI_Comm_set_name (MPI_Comm comm, const char* name) { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; diff --git a/src/smpi/bindings/smpi_pmpi_type.cpp b/src/smpi/bindings/smpi_pmpi_type.cpp index 108050c578..7d3e0db66b 100644 --- a/src/smpi/bindings/smpi_pmpi_type.cpp +++ b/src/smpi/bindings/smpi_pmpi_type.cpp @@ -273,7 +273,7 @@ int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, } -int PMPI_Type_set_name(MPI_Datatype datatype, char * name) +int PMPI_Type_set_name(MPI_Datatype datatype, const char * name) { if (datatype == MPI_DATATYPE_NULL) { return MPI_ERR_TYPE; diff --git a/src/smpi/include/smpi_comm.hpp b/src/smpi/include/smpi_comm.hpp index 3d0077335a..eab2d2ce1b 100644 --- a/src/smpi/include/smpi_comm.hpp +++ b/src/smpi/include/smpi_comm.hpp @@ -44,7 +44,7 @@ public: int size(); int rank(); void get_name(char* name, int* len); - void set_name(char* name); + void set_name(const char* name); MPI_Info info(); void set_info( MPI_Info info); void set_leaders_comm(MPI_Comm leaders); diff --git a/src/smpi/include/smpi_datatype.hpp b/src/smpi/include/smpi_datatype.hpp index 202956111b..01206eae64 100644 --- a/src/smpi/include/smpi_datatype.hpp +++ b/src/smpi/include/smpi_datatype.hpp @@ -121,7 +121,7 @@ public: int extent(MPI_Aint* lb, MPI_Aint* extent); MPI_Aint get_extent() { return ub_ - lb_; }; void get_name(char* name, int* length); - void set_name(char* name); + void set_name(const char* name); static int copy(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype); virtual void serialize(const void* noncontiguous, void* contiguous, int count); diff --git a/src/smpi/include/smpi_status.hpp b/src/smpi/include/smpi_status.hpp index debe7ca064..b5c67369cd 100644 --- a/src/smpi/include/smpi_status.hpp +++ b/src/smpi/include/smpi_status.hpp @@ -20,7 +20,7 @@ static void empty(MPI_Status * status); static int cancelled (const MPI_Status * status); static void set_cancelled (MPI_Status * status, int flag); static void set_elements (MPI_Status * status, MPI_Datatype , int count); -static int get_count(MPI_Status * status, MPI_Datatype datatype); +static int get_count(const MPI_Status * status, MPI_Datatype datatype); }; diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index f3cec23338..67dee29052 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -130,7 +130,7 @@ void Comm::get_name (char* name, int* len) } } -void Comm::set_name (char* name) +void Comm::set_name (const char* name) { if (this == MPI_COMM_UNINITIALIZED){ smpi_process()->comm_world()->set_name(name); diff --git a/src/smpi/mpi/smpi_datatype.cpp b/src/smpi/mpi/smpi_datatype.cpp index 766629ea13..8cfb5508cf 100644 --- a/src/smpi/mpi/smpi_datatype.cpp +++ b/src/smpi/mpi/smpi_datatype.cpp @@ -244,7 +244,7 @@ void Datatype::get_name(char* name, int* length){ strncpy(name, name_, *length+1); } -void Datatype::set_name(char* name){ +void Datatype::set_name(const char* name){ if(name_!=nullptr && (flags_ & DT_FLAG_PREDEFINED) == 0) xbt_free(name_); name_ = xbt_strdup(name); diff --git a/src/smpi/mpi/smpi_status.cpp b/src/smpi/mpi/smpi_status.cpp index 6900f3d4ad..7c8d6e1d9e 100644 --- a/src/smpi/mpi/smpi_status.cpp +++ b/src/smpi/mpi/smpi_status.cpp @@ -36,7 +36,7 @@ void Status::set_elements (MPI_Status * status, MPI_Datatype , int count){ status->count=count; } -int Status::get_count(MPI_Status * status, MPI_Datatype datatype) +int Status::get_count(const MPI_Status * status, MPI_Datatype datatype) { return status->count / datatype->size(); } -- 2.20.1