From eca53b48d6ee6ff59cb084d521a3ece306c63867 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 6 Jul 2018 15:25:38 +0200 Subject: [PATCH] Fix warning by putting the array only where it's needed --- include/smpi/smpi.h | 4 ---- src/smpi/bindings/smpi_pmpi.cpp | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) 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; -- 2.20.1