Skip to content

Commit

Permalink
Fix. Compile time warnings about unused var/typdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
moteus committed Aug 5, 2018
1 parent 185a03e commit e15f7d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lceasy.c
Expand Up @@ -124,7 +124,7 @@ static int lcurl_easy_cleanup(lua_State *L){
int i;

if(p->multi){
CURLMcode code = lcurl__multi_remove_handle(L, p->multi, p);
LCURL_UNUSED_VAR CURLMcode code = lcurl__multi_remove_handle(L, p->multi, p);

//! @todo what I can do if I can not remove it???
}
Expand Down
10 changes: 9 additions & 1 deletion src/lcutils.h
Expand Up @@ -25,11 +25,19 @@
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 0
#endif

#ifdef __GNUC__
#define LCURL_UNUSED_TYPEDEF __attribute__ ((unused))
#else
#define LCURL_UNUSED_TYPEDEF
#endif

#define LCURL_UNUSED_VAR LCURL_UNUSED_TYPEDEF

#define LCURL_MAKE_VERSION(MIN, MAJ, PAT) ((MIN<<16) + (MAJ<<8) + PAT)
#define LCURL_CURL_VER_GE(MIN, MAJ, PAT) (LIBCURL_VERSION_NUM >= LCURL_MAKE_VERSION(MIN, MAJ, PAT))

#define LCURL_CONCAT_STATIC_ASSERT_IMPL_(x, y) LCURL_CONCAT1_STATIC_ASSERT_IMPL_ (x, y)
#define LCURL_CONCAT1_STATIC_ASSERT_IMPL_(x, y) x##y
#define LCURL_CONCAT1_STATIC_ASSERT_IMPL_(x, y) LCURL_UNUSED_TYPEDEF x##y
#define LCURL_STATIC_ASSERT(expr) typedef char LCURL_CONCAT_STATIC_ASSERT_IMPL_(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1]

#define LCURL_ASSERT_SAME_SIZE(a, b) LCURL_STATIC_ASSERT( sizeof(a) == sizeof(b) )
Expand Down

0 comments on commit e15f7d2

Please sign in to comment.