commit b49e82a82ff1038bfaff94d35f57cea0d7e32ef3
parent 2e0b73bd98b3f12ec3fcf815fc9dab9ec6201efb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 23 Jan 2024 11:03:53 +0100
Fix compiler warning when using snprintf
snprintf is not defined in libc when compiling C89 code: it has been
standardized in C99 and POSIX.1-2001. Although the _POSIX_C_SOURCE macro
was defined with the correct value (i.e. 200112L), it was defined
_after_ the first inclusion, whereas it should be defined before the
inclusion of any header file. Hence the compilation warning.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -13,11 +13,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <star/sg3d.h>
#ifdef STARDIS_ENABLE_MPI
-#define _POSIX_C_SOURCE 200112L
+ #define _POSIX_C_SOURCE 200112L
#endif
+#include <star/sg3d.h>
+
#include "stardis-app.h"
#include "stardis-args.h"
#include "stardis-description.h"
@@ -43,8 +44,8 @@
#include <string.h>
#ifdef STARDIS_ENABLE_MPI
-#include <stdio.h>
-#include <mpi.h>
+ #include <stdio.h>
+ #include <mpi.h>
#endif
static const struct dummies DUMMIES_NULL = DUMMIES_NULL__;