dovecot-2.2: Reverted the recent hash.h changes. Instead use -Wn...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 25 16:13:09 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/4baf0183f13d
changeset: 15935:4baf0183f13d
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 25 16:12:49 2013 +0200
description:
Reverted the recent hash.h changes. Instead use -Wno-duplicate-decl-specifier with clang.
The modified version required hash table users to know the structs'
contents, which isn't otherwise necessary.
diffstat:
configure.ac | 11 ++++++++++-
src/lib/hash-decl.h | 1 +
src/lib/hash.h | 10 +++++-----
src/lib/macros.h | 3 ---
4 files changed, 16 insertions(+), 9 deletions(-)
diffs (93 lines):
diff -r 95ecdd9e13bf -r 4baf0183f13d configure.ac
--- a/configure.ac Mon Feb 25 15:55:06 2013 +0200
+++ b/configure.ac Mon Feb 25 16:12:49 2013 +0200
@@ -318,7 +318,16 @@
# -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
- if test "$have_clang" != "yes"; then
+ if test "$have_clang" = "yes"; then
+ AC_TRY_COMPILE([
+ #if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3)
+ # error new clang
+ #endif
+ ],,,[
+ # clang 3.3+ unfortunately this gives warnings with hash.h
+ CFLAGS="$CFLAGS -Wno-duplicate-decl-specifier"
+ ])
+ else
# This is simply to avoid warning when building strftime() wrappers..
CFLAGS="$CFLAGS -fno-builtin-strftime"
fi
diff -r 95ecdd9e13bf -r 4baf0183f13d src/lib/hash-decl.h
--- a/src/lib/hash-decl.h Mon Feb 25 15:55:06 2013 +0200
+++ b/src/lib/hash-decl.h Mon Feb 25 16:12:49 2013 +0200
@@ -5,6 +5,7 @@
struct hash_table *_table; \
key_type _key; \
key_type *_keyp; \
+ const key_type _const_key; \
value_type _value; \
value_type *_valuep; \
}
diff -r 95ecdd9e13bf -r 4baf0183f13d src/lib/hash.h
--- a/src/lib/hash.h Mon Feb 25 15:55:06 2013 +0200
+++ b/src/lib/hash.h Mon Feb 25 16:12:49 2013 +0200
@@ -31,12 +31,12 @@
!__builtin_types_compatible_p(typeof(&key_cmp_cb), \
int (*)(typeof((*table)._key), typeof((*table)._key))) && \
!__builtin_types_compatible_p(typeof(&key_cmp_cb), \
- int (*)(typeof(const typeof(*(*table)._key) *), typeof(const typeof(*(*table)._key) *)))); \
+ int (*)(typeof((*table)._const_key), typeof((*table)._const_key)))); \
(void)COMPILE_ERROR_IF_TRUE( \
!__builtin_types_compatible_p(typeof(&hash_cb), \
unsigned int (*)(typeof((*table)._key))) && \
!__builtin_types_compatible_p(typeof(&hash_cb), \
- unsigned int (*)(typeof(const typeof(*(*table)._key) *)))); \
+ unsigned int (*)(typeof((*table)._const_key)))); \
hash_table_create(&(*table)._table, pool, size, \
(hash_callback_t *)hash_cb, \
(hash_cmp_callback_t *)key_cmp_cb);})
@@ -77,14 +77,14 @@
void *hash_table_lookup(const struct hash_table *table, const void *key) ATTR_PURE;
#define hash_table_lookup(table, key) \
HASH_VALUE_CAST(table)hash_table_lookup((table)._table, \
- (const void *)((const char *)(key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((table)._key, key)))
+ (const void *)((const char *)(key) + COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._key, (table)._const_key, key)))
bool hash_table_lookup_full(const struct hash_table *table,
const void *lookup_key,
void **orig_key_r, void **value_r);
#define hash_table_lookup_full(table, lookup_key, orig_key_r, value_r) \
hash_table_lookup_full((table)._table, \
- (void *)((const char *)(lookup_key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((table)._key, lookup_key)), \
+ (void *)((const char *)(lookup_key) + COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, lookup_key)), \
(void **)(void *)((orig_key_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._keyp, orig_key_r) + \
COMPILE_ERROR_IF_TRUE(sizeof(*orig_key_r) != sizeof(void *))), \
(void **)(void *)((value_r) + COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE((table)._valuep, value_r) + \
@@ -106,7 +106,7 @@
void hash_table_remove(struct hash_table *table, const void *key);
#define hash_table_remove(table, key) \
hash_table_remove((table)._table, \
- (const void *)((const char *)(key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((table)._key, key)))
+ (const void *)((const char *)(key) + COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, key)))
unsigned int hash_table_count(const struct hash_table *table) ATTR_PURE;
#define hash_table_count(table) \
hash_table_count((table)._table)
diff -r 95ecdd9e13bf -r 4baf0183f13d src/lib/macros.h
--- a/src/lib/macros.h Mon Feb 25 15:55:06 2013 +0200
+++ b/src/lib/macros.h Mon Feb 25 16:12:49 2013 +0200
@@ -160,13 +160,10 @@
COMPILE_ERROR_IF_TRUE( \
!__builtin_types_compatible_p(typeof(_a1), typeof(_b)) && \
!__builtin_types_compatible_p(typeof(_a2), typeof(_b)))
-#define COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE(_a, _b) \
- COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE(_a, typeof(const typeof(*_a) *), _b)
#else
# define COMPILE_ERROR_IF_TRUE(condition) 0
# define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) 0
# define COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE(_a1, _a2, _b) 0
-# define COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE(_a, _b) 0
#endif
#if __GNUC__ > 2
More information about the dovecot-cvs
mailing list