orcarray: Fix compiler warning with gcc 4.9
authorSebastian Dröge <sebastian@centricular.com>
Mon, 14 Apr 2014 19:53:40 +0000 (21:53 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 14 Apr 2014 19:53:40 +0000 (21:53 +0200)
In file included from ../orc/orcprogram.h:5:0,
                 from ../orc/orc.h:5,
                 from ../orc-test/orctest.h:5,
                 from orcarray.c:6:
../orc/orcutils.h:124:37: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
                                     ^
orcarray.c:42:9: note: 'data' was declared here
   void *data;

orc-test/orcarray.c

index 9860204..089b0d1 100644 (file)
@@ -42,7 +42,7 @@ orc_array_new (int n, int m, int element_size, int misalignment,
   void *data;
 #ifndef USE_MMAP
 #ifdef HAVE_POSIX_MEMALIGN
-  int ret ORC_GNUC_UNUSED;
+  int ret;
 #endif
 #endif
   int offset;
@@ -71,6 +71,7 @@ orc_array_new (int n, int m, int element_size, int misalignment,
 #else
 #ifdef HAVE_POSIX_MEMALIGN
   ret = posix_memalign (&data, ALIGNMENT, ar->alloc_len);
+  ORC_ASSERT (ret == 0);
   ar->alloc_data = data;
   ar->aligned_data = data;
 #else