]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fixed "duplicate const" warnings with new clang.
authorTimo Sirainen <tss@iki.fi>
Sun, 24 Feb 2013 06:46:28 +0000 (08:46 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 24 Feb 2013 06:46:28 +0000 (08:46 +0200)
src/lib/hash-decl.h
src/lib/hash.h
src/lib/macros.h

index 60fb4e1b73f65f1f4a9871731a060396d4f78807..51bd2d10b9900a213bf4c06eec1eba0c1b246497 100644 (file)
@@ -5,7 +5,6 @@
                struct hash_table *_table; \
                key_type _key; \
                key_type *_keyp; \
-               const key_type _const_key; \
                value_type _value; \
                value_type *_valuep; \
        }
index f0ccb67de10000e9f70c9907a64bc8177db9c018..e6960e069ed18a6a96cf486827288d1b090801dd 100644 (file)
@@ -27,16 +27,6 @@ void hash_table_create(struct hash_table **table_r, pool_t node_pool,
        ({(void)COMPILE_ERROR_IF_TRUE( \
                sizeof((*table)._key) != sizeof(void *) || \
                sizeof((*table)._value) != sizeof(void *)); \
-       (void)COMPILE_ERROR_IF_TRUE( \
-               !__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((*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((*table)._const_key)))); \
        hash_table_create(&(*table)._table, pool, size, \
                (hash_callback_t *)hash_cb, \
                (hash_cmp_callback_t *)key_cmp_cb);})
@@ -77,14 +67,14 @@ void hash_table_clear(struct hash_table *table, bool free_collisions);
 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_TYPES2_NOT_COMPATIBLE((table)._key, (table)._const_key, key)))
+               (const void *)((const char *)(key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((table)._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_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, lookup_key)), \
+               (void *)((const char *)(lookup_key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((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 +96,7 @@ void hash_table_update(struct hash_table *table, void *key, void *value);
 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_TYPES2_NOT_COMPATIBLE((table)._const_key, (table)._key, key)))
+               (const void *)((const char *)(key) + COMPILE_ERROR_IF_CONST_TYPES_NOT_COMPATIBLE((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)
index 9a507db6578ed898a4a71946f5d7735685482914..2c739a4d29b3c733343a5ddfc5d4af9eda08382f 100644 (file)
        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