Merge pull request #88 from moteus/master
Fix. Do not use redefine typedefs as forward declaration (Close #85)
This commit is contained in:
commit
bde6a9de76
28
.travis.yml
28
.travis.yml
@ -2,18 +2,31 @@ language: c
|
||||
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- LCURL_CC_FLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs"
|
||||
- LCURL_LD_FLAGS="-shared --coverage"
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: ": Lua51-osx"
|
||||
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,19 +39,22 @@ branches:
|
||||
|
||||
before_install:
|
||||
- export CC=gcc
|
||||
- gcc --version
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PATH:~/Library/Python/2.7/bin/; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export LCURL_LD_FLAGS="-bundle -undefined dynamic_lookup -all_load --coverage"; 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"
|
||||
- luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="$LCURL_CC_FLAGS" LIBFLAG="$LCURL_LD_FLAGS"
|
||||
|
||||
before_script:
|
||||
- luarocks show luacov-coveralls || luarocks install luacov-coveralls
|
||||
- luarocks show lunitx || luarocks install lunitx
|
||||
- luarocks show luafilesystem || luarocks install luafilesystem
|
||||
- luarocks show dkjson || luarocks install dkjson --deps-mode=none
|
||||
- luarocks show luacov-coveralls > /dev/null 2>&1 || luarocks install luacov-coveralls
|
||||
- luarocks show lunitx > /dev/null 2>&1 || luarocks install lunitx
|
||||
- luarocks show luafilesystem > /dev/null 2>&1 || luarocks install luafilesystem
|
||||
- luarocks show dkjson > /dev/null 2>&1 || luarocks install dkjson --deps-mode=none
|
||||
|
||||
script:
|
||||
- cd test
|
||||
|
@ -21,6 +21,7 @@ platform:
|
||||
|
||||
cache:
|
||||
- c:\hererocks -> appveyor.yml
|
||||
- c:\external -> appveyor.yml
|
||||
|
||||
install:
|
||||
- set PATH=C:\Python27\Scripts;%LR_EXTERNAL%;%PATH%
|
||||
@ -35,9 +36,9 @@ install:
|
||||
)
|
||||
- if not exist c:\hererocks (
|
||||
pip install hererocks &&
|
||||
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest &&
|
||||
call c:\hererocks\bin\activate
|
||||
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest
|
||||
)
|
||||
- call c:\hererocks\bin\activate
|
||||
|
||||
before_build:
|
||||
# external deps
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -13,6 +13,18 @@
|
||||
|
||||
#include "lcurl.h"
|
||||
|
||||
#if defined(_MSC_VER) || defined(__cplusplus)
|
||||
# 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))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user