Fix. Do not use redefine typedefs as forward declaration.

master
Alexey Melnichuk 2017-01-12 18:03:11 +03:00
parent 00c1bc4687
commit e65cb95567
4 changed files with 43 additions and 1 deletions

View File

@ -6,14 +6,22 @@ matrix:
include:
- compiler: ": Lua51"
env: LUA="lua 5.1"
os: osx
- compiler: ": Lua51"
env: LUA="lua 5.1"
os: linux
- compiler: ": Lua52"
env: LUA="lua 5.2"
os: linux
- compiler: ": Lua53"
env: LUA="lua 5.3"
os: linux
- compiler: ": LuaJIT20"
env: LUA="luajit 2.0"
os: linux
- compiler: ": LuaJIT21"
env: LUA="luajit 2.1"
os: linux
cache:
directories:
@ -26,10 +34,11 @@ branches:
before_install:
- export CC=gcc
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PATH:~/Library/Python/2.7/bin/; fi
- pip install --user cpp-coveralls
- pip install --user hererocks
- hererocks here -r^ --$LUA
- export PATH=$PATH:$PWD/here/bin
- source here/bin/activate
install:
- luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"

View File

@ -35,7 +35,12 @@ enum {
#define LCURL_EASY_MAGIC 0xEA
#if LCURL_CC_SUPPORT_FORWARD_TYPEDEF
typedef struct lcurl_multi_tag lcurl_multi_t;
#else
struct lcurl_multi_tag;
#define lcurl_multi_t struct lcurl_multi_tag
#endif
typedef struct lcurl_easy_tag{
unsigned char magic;
@ -67,4 +72,8 @@ void lcurl_easy_initlib(lua_State *L, int nup);
void lcurl__easy_assign_lua(lua_State *L, lcurl_easy_t *p, lua_State *value, int assign_multi);
#if !LCURL_CC_SUPPORT_FORWARD_TYPEDEF
#undef lcurl_multi_t
#endif
#endif

View File

@ -23,6 +23,14 @@ typedef struct lcurl_multi_tag{
lcurl_callback_t sc;
}lcurl_multi_t;
#if LCURL_CC_SUPPORT_FORWARD_TYPEDEF
typedef struct lcurl_multi_tag lcurl_multi_t;
#else
struct lcurl_easy_tag;
#define lcurl_easy_t struct lcurl_easy_tag
#endif
int lcurl_multi_create(lua_State *L, int error_mode);
lcurl_multi_t *lcurl_getmulti_at(lua_State *L, int i);
@ -35,4 +43,8 @@ void lcurl__multi_assign_lua(lua_State *L, lcurl_multi_t *p, lua_State *value, i
CURLMcode lcurl__multi_remove_handle(lua_State *L, lcurl_multi_t *p, lcurl_easy_t *e);
#if !LCURL_CC_SUPPORT_FORWARD_TYPEDEF
#undef lcurl_easy_t
#endif
#endif

View File

@ -13,6 +13,18 @@
#include "lcurl.h"
#ifdef _MSC_VER
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 1
#elif defined(__STDC_VERSION__)
# if __STDC_VERSION__ >= 201112
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 1
# endif
#endif
#ifndef LCURL_CC_SUPPORT_FORWARD_TYPEDEF
# define LCURL_CC_SUPPORT_FORWARD_TYPEDEF 0
#endif
#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))