From 93c4d8f5f4ef7fa8776f6fcf3ed2c41ae6434de1 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Thu, 17 Sep 2015 15:40:09 +0100
Subject: [PATCH] Fix various compiler warnings

Now we have -Werror these are needed


Former-commit-id: 10a072fdd3f1a6ee7f54c5c7b1afa7d443f58eaa
---
 src/engine.c      |  4 ++--
 src/parallel_io.c |  3 ---
 src/serial_io.c   | 13 ++-----------
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 26545aa96e..ecc48ba336 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -293,7 +293,7 @@ void engine_repartition(struct engine *e) {
 
   int i, j, k, l, cid, cjd, ii, jj, kk, res;
   idx_t *inds, *nodeIDs;
-  idx_t *weights_v, *weights_e;
+  idx_t *weights_v = NULL, *weights_e = NULL;
   struct space *s = e->s;
   int nr_cells = s->nr_cells, my_cells = 0;
   struct cell *cells = s->cells;
@@ -366,7 +366,7 @@ void engine_repartition(struct engine *e) {
 
     /* Get the task weight. */
     idx_t w = (t->toc - t->tic) * wscale;
-    if (w < 0) error("Bad task weight (%i).", w);
+    if (w < 0) error("Bad task weight (%"SCIDX").", w);
 
     /* Do we need to re-scale? */
     wtot += w;
diff --git a/src/parallel_io.c b/src/parallel_io.c
index adcb997e57..1d6188e80d 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -23,9 +23,6 @@
 
 #if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
 
-/* Tell hdf5 that we intend to use shared-memory parallel stuff. */
-#define H5_HAVE_PARALLEL
-
 /* Some standard headers. */
 #include <hdf5.h>
 #include <math.h>
diff --git a/src/serial_io.c b/src/serial_io.c
index a9993f0ef7..501ecd3d56 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -325,12 +325,7 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name,
                   enum DATA_TYPE type, long long N_total, int dim,
                   struct UnitSystem* us, enum UnitConversionFactor convFactor) {
   hid_t h_data = 0, h_err = 0, h_space = 0;
-  void* temp = 0;
-  int i = 0, rank = 0;
-  const size_t typeSize = sizeOfType(type);
-  const size_t copySize = typeSize * dim;
-  const size_t partSize = sizeof(struct part);
-  char* temp_c = 0;
+  int rank = 0;
   hsize_t shape[2];
   char buffer[150];
 
@@ -399,7 +394,7 @@ void writeArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
                        int dim, long long N_total, long long offset,
                        char* part_c) {
   hid_t h_data = 0, h_err = 0, h_memspace = 0, h_filespace = 0;
-  hsize_t shape[2], shape_total[2], offsets[2];
+  hsize_t shape[2], offsets[2];
   void* temp = 0;
   int i = 0, rank = 0;
   const size_t typeSize = sizeOfType(type);
@@ -423,16 +418,12 @@ void writeArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
     rank = 2;
     shape[0] = N;
     shape[1] = dim;
-    shape_total[0] = N_total;
-    shape_total[1] = dim;
     offsets[0] = offset;
     offsets[1] = 0;
   } else {
     rank = 1;
     shape[0] = N;
     shape[1] = 0;
-    shape_total[0] = N_total;
-    shape_total[1] = 0;
     offsets[0] = offset;
     offsets[1] = 0;
   }
-- 
GitLab