From 7b7af60dcd642b86bbb946f302d6c61af05c75d0 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 23 Jun 2008 00:51:50 +0200 Subject: [PATCH] Use gcc to find places needing a a_tokenize call. Signed-off-by: Pierre Habouzit --- common/util.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/util.h b/common/util.h index 80a79e165..b616db61e 100644 --- a/common/util.h +++ b/common/util.h @@ -225,8 +225,17 @@ char * a_strndup(const char *s, ssize_t l) */ static inline int a_strcmp(const char *a, const char *b) { - return strcmp(NONULL(a), NONULL(b)); + return strcmp(NONULL(a), NONULL(b)); } +#ifdef __GNUC__ +#define a_strcmp(a, b) \ + ({ \ + __builtin_choose_expr(__builtin_constant_p(a) || __builtin_constant_p(b), \ + (void)({__asm__(".warning \"you may want to use a_tokenize here\"");}), \ + (void)0); \ + (a_strcmp)((a), (b)); \ + }) +#endif /** \brief \c NULL resistant strcasecmp. * \param[in] a the first string.