changeset 3214:e3f6748c59ba HEAD

ARRAY_SET_TYPE() in non-DEBUG-mode was giving errors with older gccs if it was used at the beginning of a function (function can't start with ";").
author Timo Sirainen <tss@iki.fi>
date Fri, 18 Mar 2005 19:33:53 +0200
parents 69b056a3657f
children 929091768426
files src/lib/array.h
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/array.h	Wed Mar 16 22:18:13 2005 +0200
+++ b/src/lib/array.h	Fri Mar 18 19:33:53 2005 +0200
@@ -51,8 +51,16 @@
 #else
 #  define ARRAY_DEFINE(name, array_type) name
 #  define ARRAY_CREATE(array, pool, array_type, init_count) \
-	array_create(array, pool, sizeof(array_type), init_count);
-#  define ARRAY_SET_TYPE(array, array_type)
+	array_create(array, pool, sizeof(array_type), init_count)
+/* The reason we do this for non-ARRAY_TYPE_CHECKS as well is because if we
+   left this empty, some compilers wouldn't like an extra ";" character at
+   the beginning of the function (eg. gcc 2.95).
+
+   However just declaring the variable gives "unused variable" warning.
+   I couldn't think of anything better, so we just use gcc-specific
+   unused-attribute to get rid of that with gcc. */
+#  define ARRAY_SET_TYPE(array, array_type) \
+	array_type **array ## __ ## type __attr_unused__ = NULL
 #  define ARRAY_INIT { 0, 0 }
 #endif