summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-02-15 00:03:29 -0500
committerNick Mathewson <nickm@torproject.org>2014-02-15 00:03:29 -0500
commit339a47e80bcb898f96e41b9110dda07dd3a2fd05 (patch)
tree8cf95d1bc42cb6dd12c36531f4075078924e4f36 /src/common
parent198789462609c339d60d554fa398a0d6dbe7a962 (diff)
parente4bc757cde98ed50723bab176eca77ad57cc483c (diff)
downloadtor-339a47e80bcb898f96e41b9110dda07dd3a2fd05.tar.gz
tor-339a47e80bcb898f96e41b9110dda07dd3a2fd05.zip
Merge remote-tracking branch 'origin/maint-0.2.4'
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.h2
-rw-r--r--src/common/container.h46
2 files changed, 30 insertions, 18 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 8e700a9a13..32effa5c74 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -169,6 +169,7 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
*
* #define ATTR_NONNULL(x) __attribute__((nonnull x)) */
#define ATTR_NONNULL(x)
+#define ATTR_UNUSED __attribute__ ((unused))
/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
* of <b>exp</b> will probably be true.
@@ -192,6 +193,7 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
#define ATTR_MALLOC
#define ATTR_NORETURN
#define ATTR_NONNULL(x)
+#define ATTR_UNUSED
#define PREDICT_LIKELY(exp) (exp)
#define PREDICT_UNLIKELY(exp) (exp)
#endif
diff --git a/src/common/container.h b/src/common/container.h
index 1bcc540665..d6c80b808d 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -472,64 +472,74 @@ void* strmap_remove_lc(strmap_t *map, const char *key);
#define DECLARE_TYPED_DIGESTMAP_FNS(prefix, maptype, valtype) \
typedef struct maptype maptype; \
typedef struct prefix##iter_t prefix##iter_t; \
- static INLINE maptype* prefix##new(void) \
+ ATTR_UNUSED static INLINE maptype* \
+ prefix##new(void) \
{ \
return (maptype*)digestmap_new(); \
} \
- static INLINE digestmap_t* prefix##to_digestmap(maptype *map) \
+ ATTR_UNUSED static INLINE digestmap_t* \
+ prefix##to_digestmap(maptype *map) \
{ \
return (digestmap_t*)map; \
} \
- static INLINE valtype* prefix##get(maptype *map, const char *key) \
+ ATTR_UNUSED static INLINE valtype* \
+ prefix##get(maptype *map, const char *key) \
{ \
return (valtype*)digestmap_get((digestmap_t*)map, key); \
} \
- static INLINE valtype* prefix##set(maptype *map, const char *key, \
- valtype *val) \
+ ATTR_UNUSED static INLINE valtype* \
+ prefix##set(maptype *map, const char *key, valtype *val) \
{ \
return (valtype*)digestmap_set((digestmap_t*)map, key, val); \
} \
- static INLINE valtype* prefix##remove(maptype *map, const char *key) \
+ ATTR_UNUSED static INLINE valtype* \
+ prefix##remove(maptype *map, const char *key) \
{ \
return (valtype*)digestmap_remove((digestmap_t*)map, key); \
} \
- static INLINE void prefix##free(maptype *map, void (*free_val)(void*)) \
+ ATTR_UNUSED static INLINE void \
+ prefix##free(maptype *map, void (*free_val)(void*)) \
{ \
digestmap_free((digestmap_t*)map, free_val); \
} \
- static INLINE int prefix##isempty(maptype *map) \
+ ATTR_UNUSED static INLINE int \
+ prefix##isempty(maptype *map) \
{ \
return digestmap_isempty((digestmap_t*)map); \
} \
- static INLINE int prefix##size(maptype *map) \
+ ATTR_UNUSED static INLINE int \
+ prefix##size(maptype *map) \
{ \
return digestmap_size((digestmap_t*)map); \
} \
- static INLINE prefix##iter_t *prefix##iter_init(maptype *map) \
+ ATTR_UNUSED static INLINE \
+ prefix##iter_t *prefix##iter_init(maptype *map) \
{ \
return (prefix##iter_t*) digestmap_iter_init((digestmap_t*)map); \
} \
- static INLINE prefix##iter_t *prefix##iter_next(maptype *map, \
- prefix##iter_t *iter) \
+ ATTR_UNUSED static INLINE \
+ prefix##iter_t *prefix##iter_next(maptype *map, prefix##iter_t *iter) \
{ \
return (prefix##iter_t*) digestmap_iter_next( \
(digestmap_t*)map, (digestmap_iter_t*)iter); \
} \
- static INLINE prefix##iter_t *prefix##iter_next_rmv(maptype *map, \
- prefix##iter_t *iter) \
+ ATTR_UNUSED static INLINE prefix##iter_t* \
+ prefix##iter_next_rmv(maptype *map, prefix##iter_t *iter) \
{ \
return (prefix##iter_t*) digestmap_iter_next_rmv( \
(digestmap_t*)map, (digestmap_iter_t*)iter); \
} \
- static INLINE void prefix##iter_get(prefix##iter_t *iter, \
- const char **keyp, \
- valtype **valp) \
+ ATTR_UNUSED static INLINE void \
+ prefix##iter_get(prefix##iter_t *iter, \
+ const char **keyp, \
+ valtype **valp) \
{ \
void *v; \
digestmap_iter_get((digestmap_iter_t*) iter, keyp, &v); \
*valp = v; \
} \
- static INLINE int prefix##iter_done(prefix##iter_t *iter) \
+ ATTR_UNUSED static INLINE int \
+ prefix##iter_done(prefix##iter_t *iter) \
{ \
return digestmap_iter_done((digestmap_iter_t*)iter); \
}