From 1b73237787f417bb177a5ae41878fd805c388e5d Mon Sep 17 00:00:00 2001 From: doursse Date: Thu, 3 Apr 2008 19:47:07 +0000 Subject: [PATCH] add unsued attribute when needed SVN revision: 34184 --- legacy/eet/configure.in | 20 ++++++++++++++++++-- legacy/eet/src/lib/eet_data.c | 28 +++++++++++++++++----------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/legacy/eet/configure.in b/legacy/eet/configure.in index 385dfe488a..41136fdaea 100644 --- a/legacy/eet/configure.in +++ b/legacy/eet/configure.in @@ -28,8 +28,6 @@ SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'` version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN" AC_SUBST(version_info) -AC_FUNC_ALLOCA - WIN32_CFLAGS="" WIN32_LIBS="" create_shared_lib="" @@ -52,6 +50,24 @@ AC_SUBST(WIN32_CFLAGS) AC_SUBST(WIN32_LIBS) AC_SUBST(create_shared_lib) +dnl Checking for __attribute__ support +AC_MSG_CHECKING([for __attribute__]) +AC_CACHE_VAL(have___attribute__, + [ + AC_TRY_COMPILE([#include ], + [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }], + [have___attribute__="yes"], + [have___attribute__="no"]) + ] +) + +if test "x${have___attribute__}" = "xyes" ; then + AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__]) +fi +AC_MSG_RESULT(${have___attribute__}) + +AC_FUNC_ALLOCA + AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")) AC_CHECK_HEADER(jpeglib.h,, AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")) diff --git a/legacy/eet/src/lib/eet_data.c b/legacy/eet/src/lib/eet_data.c index 154375a9c6..98c5c8ee62 100644 --- a/legacy/eet/src/lib/eet_data.c +++ b/legacy/eet/src/lib/eet_data.c @@ -6,6 +6,12 @@ # include #endif +#if HAVE___ATTRIBUTE__ +#define __UNUSED__ __attribute__((unused)) +#else +#define __UNUSED__ +#endif + #include #include #include @@ -243,7 +249,7 @@ static int words_bigendian = -1; /* CHAR TYPE */ static int -eet_data_get_char(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) +eet_data_get_char(const Eet_Dictionary *ed __UNUSED__, const void *src, const void *src_end, void *dst) { char *s, *d; @@ -256,7 +262,7 @@ eet_data_get_char(const Eet_Dictionary *ed, const void *src, const void *src_end } static void * -eet_data_put_char(Eet_Dictionary *ed, const void *src, int *size_ret) +eet_data_put_char(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret) { char *s, *d; @@ -271,7 +277,7 @@ eet_data_put_char(Eet_Dictionary *ed, const void *src, int *size_ret) /* SHORT TYPE */ static int -eet_data_get_short(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) +eet_data_get_short(const Eet_Dictionary *ed __UNUSED__, const void *src, const void *src_end, void *dst) { short *d; @@ -283,7 +289,7 @@ eet_data_get_short(const Eet_Dictionary *ed, const void *src, const void *src_en } static void * -eet_data_put_short(Eet_Dictionary *ed, const void *src, int *size_ret) +eet_data_put_short(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret) { short *s, *d; @@ -298,7 +304,7 @@ eet_data_put_short(Eet_Dictionary *ed, const void *src, int *size_ret) /* INT TYPE */ static int -eet_data_get_int(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) +eet_data_get_int(const Eet_Dictionary *ed __UNUSED__, const void *src, const void *src_end, void *dst) { int *d; @@ -310,7 +316,7 @@ eet_data_get_int(const Eet_Dictionary *ed, const void *src, const void *src_end, } static void * -eet_data_put_int(Eet_Dictionary *ed, const void *src, int *size_ret) +eet_data_put_int(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret) { int *s, *d; @@ -325,7 +331,7 @@ eet_data_put_int(Eet_Dictionary *ed, const void *src, int *size_ret) /* LONG LONG TYPE */ static int -eet_data_get_long_long(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) +eet_data_get_long_long(const Eet_Dictionary *ed __UNUSED__, const void *src, const void *src_end, void *dst) { unsigned long long *d; @@ -337,7 +343,7 @@ eet_data_get_long_long(const Eet_Dictionary *ed, const void *src, const void *sr } static void * -eet_data_put_long_long(Eet_Dictionary *ed, const void *src, int *size_ret) +eet_data_put_long_long(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret) { unsigned long long *s, *d; @@ -416,13 +422,13 @@ eet_data_put_string(Eet_Dictionary *ed, const void *src, int *size_ret) /* ALWAYS INLINED STRING TYPE */ static int -eet_data_get_istring(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst) +eet_data_get_istring(const Eet_Dictionary *ed __UNUSED__, const void *src, const void *src_end, void *dst) { return eet_data_get_string(NULL, src, src_end, dst); } static void * -eet_data_put_istring(Eet_Dictionary *ed, const void *src, int *size_ret) +eet_data_put_istring(Eet_Dictionary *ed __UNUSED__, const void *src, int *size_ret) { return eet_data_put_string(NULL, src, size_ret); } @@ -1222,7 +1228,7 @@ _eet_freelist_direct_str_free(Eet_Data_Descriptor *edd) } static int -eet_data_descriptor_encode_hash_cb(void *hash, const char *key, void *hdata, void *fdata) +eet_data_descriptor_encode_hash_cb(void *hash __UNUSED__, const char *key, void *hdata, void *fdata) { Eet_Dictionary *ed; Eet_Data_Encode_Hash_Info *edehi;