From 473f5ea563634ed2fca9963367561885067306da Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Thu, 16 Jul 2009 21:49:14 +0000 Subject: [PATCH] remove -Wextra warnings. SVN revision: 41370 --- legacy/ethumb/configure.ac | 1 + legacy/ethumb/m4/ac_attribute.m4 | 47 ++++++++++++++++++++ legacy/ethumb/src/lib/Ethumb.c | 6 +-- legacy/ethumb/src/lib/client/Ethumb_Client.c | 2 +- 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 legacy/ethumb/m4/ac_attribute.m4 diff --git a/legacy/ethumb/configure.ac b/legacy/ethumb/configure.ac index 1e53358e68..4b93482af8 100644 --- a/legacy/ethumb/configure.ac +++ b/legacy/ethumb/configure.ac @@ -14,6 +14,7 @@ AC_PROG_CC AM_PROG_CC_STDC AM_PROG_CC_C_O AC_HEADER_STDC +AC_C___ATTRIBUTE__ dnl AC_C_CONST is bogus, its tests fails on -Wall -O1 ( uninitialized values) dnl AC_C_CONST diff --git a/legacy/ethumb/m4/ac_attribute.m4 b/legacy/ethumb/m4/ac_attribute.m4 new file mode 100644 index 0000000000..23479a92ac --- /dev/null +++ b/legacy/ethumb/m4/ac_attribute.m4 @@ -0,0 +1,47 @@ +dnl Copyright (C) 2004-2008 Kim Woelders +dnl Copyright (C) 2008 Vincent Torri +dnl That code is public domain and can be freely used or copied. +dnl Originally snatched from somewhere... + +dnl Macro for checking if the compiler supports __attribute__ + +dnl Usage: AC_C___ATTRIBUTE__ +dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__ +dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is +dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused)) +dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is +dnl defined to nothing. + +AC_DEFUN([AC_C___ATTRIBUTE__], +[ + +AC_MSG_CHECKING([for __attribute__]) + +AC_CACHE_VAL([ac_cv___attribute__], + [AC_TRY_COMPILE( + [ +#include + +int func(int x); +int foo(int x __attribute__ ((unused))) +{ + exit(1); +} + ], + [], + [ac_cv___attribute__="yes"], + [ac_cv___attribute__="no"] + )]) + +AC_MSG_RESULT($ac_cv___attribute__) + +if test "x${ac_cv___attribute__}" = "xyes" ; then + AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__]) + AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused]) + else + AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused]) +fi + +]) + +dnl End of ac_attribute.m4 diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c index 557e0c1013..a9bc5cc767 100644 --- a/legacy/ethumb/src/lib/Ethumb.c +++ b/legacy/ethumb/src/lib/Ethumb.c @@ -67,7 +67,7 @@ static Eina_Hash *_plugins_ext = NULL; static Eina_Array *_plugins = NULL; static Eina_Bool -_ethumb_plugin_list_cb(Eina_Module *m, void *data) +_ethumb_plugin_list_cb(Eina_Module *m, void *data __UNUSED__) { const char *file; const char **ext; @@ -719,7 +719,7 @@ _ethumb_generate_hash(const char *file) char *uri; char *t; - const char *c; + const unsigned char *c; #define _check_uri_char(c) \ ((c) >= 32 && (c) < 128 && (ACCEPTABLE_URI_CHARS[(c) - 32] & 0x08)) @@ -730,7 +730,7 @@ _ethumb_generate_hash(const char *file) strncpy(uri, "file://", sizeof(uri)); t = uri + 7; - for (c = file; *c != '\0'; c++) + for (c = (const unsigned char *)file; *c != '\0'; c++) { if (!_check_uri_char(*c)) { diff --git a/legacy/ethumb/src/lib/client/Ethumb_Client.c b/legacy/ethumb/src/lib/client/Ethumb_Client.c index 2aaf2b635a..a5e4accf44 100644 --- a/legacy/ethumb/src/lib/client/Ethumb_Client.c +++ b/legacy/ethumb/src/lib/client/Ethumb_Client.c @@ -980,7 +980,7 @@ end: } static void -_ethumb_client_queue_clear_cb(void *data, DBusMessage *msg, DBusError *error) +_ethumb_client_queue_clear_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *error __UNUSED__) { Ethumb_Client *client = data;