From: Augustin Degomme Date: Fri, 6 Jul 2018 13:25:38 +0000 (+0200) Subject: Fix warning by putting the array only where it's needed X-Git-Tag: v3_21~550 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/eca53b48d6ee6ff59cb084d521a3ece306c63867 Fix warning by putting the array only where it's needed --- diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index f64d602268..51f09396db 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -130,10 +130,6 @@ enum ERROR_ENUM { FOREACH_ERROR(GENERATE_ENUM) }; -static const char *smpi_error_string[] = { - FOREACH_ERROR(GENERATE_STRING) -}; - #define MPI_ERRCODES_IGNORE (int *)0 #define MPI_IDENT 0 #define MPI_SIMILAR 1 diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index 8939bbf04e..b0f7cc3272 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -209,6 +209,9 @@ int PMPI_Error_class(int errorcode, int* errorclass) { } int PMPI_Error_string(int errorcode, char* string, int* resultlen){ + static const char *smpi_error_string[] = { + FOREACH_ERROR(GENERATE_STRING) + }; *resultlen = strlen(smpi_error_string[errorcode]); strncpy(string, smpi_error_string[errorcode], *resultlen); return MPI_SUCCESS;