diff --git a/.travis.yml b/.travis.yml index 979b7588e5bde3ab1b515da8222f1a90f011a15f..41937853d671d1178608b9e216338171989f18c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -203,6 +203,29 @@ matrix: ;; esac + - os: linux + dist: trusty + language: c + git: + - depth: 1 + + addons: + apt: + packages: + - build-essential + - cmake + env: + - DESC="trusty/gcc-4.8 build" + + before_script: + - cd ${TRAVIS_BUILD_DIR} + - mkdir debug + - cd debug + + script: + - cmake .. > /dev/null + - make > /dev/null + - os: linux language: c compiler: clang diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 260649050be5448a6c975abdf1b82582a9a17575..2caa4ad4368ae5da637a93ab09881f26b84c5c95 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -194,7 +194,7 @@ static int normalStmtPrepare(STscStmt* stmt) { static char* normalStmtBuildSql(STscStmt* stmt) { SNormalStmt* normal = &stmt->normal; - SStringBuilder sb = {0}; + SStringBuilder sb; memset(&sb, 0, sizeof(sb)); if (taosStringBuilderSetJmp(&sb) != 0) { taosStringBuilderDestroy(&sb); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index ebb081bb3ae168c71a1d214af303567e0fdded3a..551b0a045742a56bbd879af555185c782a524c76 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3558,7 +3558,7 @@ static int32_t setTableCondForSTableQuery(SQueryInfo* pQueryInfo, const char* ac return TSDB_CODE_SUCCESS; } - SStringBuilder sb1 = {0}; + SStringBuilder sb1; memset(&sb1, 0, sizeof(sb1)); taosStringBuilderAppendStringLen(&sb1, QUERY_COND_REL_PREFIX_IN, QUERY_COND_REL_PREFIX_IN_LEN); char db[TSDB_TABLE_ID_LEN] = {0}; @@ -3813,7 +3813,7 @@ int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, SSqlObj* pSql pQueryInfo->window.ekey = INT64_MAX; // tags query condition may be larger than 512bytes, therefore, we need to prepare enough large space - SStringBuilder sb = {0}; + SStringBuilder sb; memset(&sb, 0, sizeof(sb)); SCondExpr condExpr = {0}; if ((*pExpr)->pLeft == NULL || (*pExpr)->pRight == NULL) { diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 02af71ee66a8b24f6a0a42170316c00296c2abb7..dea76968f6a3e6af12b8661a90257623574047df 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -488,7 +488,7 @@ void tscBuildVgroupTableInfo(STableMetaInfo* pTableMetaInfo, SArray* tables) { if( prev == NULL || tt->vgId != prev->vgId ) { SVgroupsInfo* pvg = pTableMetaInfo->vgroupList; - SVgroupTableInfo info = { 0 }; + SVgroupTableInfo info = {{ 0 }}; for( int32_t m = 0; m < pvg->numOfVgroups; ++m ) { if( tt->vgId == pvg->vgroups[m].vgId ) { info.vgInfo = pvg->vgroups[m]; diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index dc5f7d192f0ccd7bb1c22c64e6d77a6fffe532f9..7949a629663455e528449c748bbd992106c4e43d 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -84,7 +84,7 @@ int32_t main(int32_t argc, char *argv[]) { } /* Set termination handler. */ - struct sigaction act = {0}; + struct sigaction act = {{0}}; act.sa_flags = SA_SIGINFO; act.sa_sigaction = signal_handler; sigaction(SIGTERM, &act, NULL); diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index 2e081de2a8f6cdd999edd57287e09a0bb5a3e2ea..86193fcebc14b0db0c326f62e298fca5f99b21e2 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -33,7 +33,7 @@ typedef struct { void (*stopFp)(); } SModule; -static SModule tsModule[TSDB_MOD_MAX] = {0}; +static SModule tsModule[TSDB_MOD_MAX] = {{0}}; static uint32_t tsModuleStatus = 0; static void dnodeSetModuleStatus(int32_t module) { diff --git a/src/os/linux/inc/os.h b/src/os/linux/inc/os.h index cab899753d654912bc10817d4114bcc931760ddd..40fcf834318aa90baf3b9ddf575618f402124623 100644 --- a/src/os/linux/inc/os.h +++ b/src/os/linux/inc/os.h @@ -253,6 +253,17 @@ void taosBlockSIGPIPE(); #define BUILDIN_CLZ(val) __builtin_clz(val) #define BUILDIN_CTZ(val) __builtin_ctz(val) +#undef threadlocal +#ifdef _ISOC11_SOURCE + #define threadlocal _Thread_local +#elif defined(__APPLE__) + #define threadlocal +#elif defined(__GNUC__) && !defined(threadlocal) + #define threadlocal __thread +#else + #define threadlocal +#endif + #ifdef __cplusplus } #endif diff --git a/src/os/linux/src/linuxPlatform.c b/src/os/linux/src/linuxPlatform.c index 72da97287feaf34b9e032cb402628d3293ef030e..73cccd020aec4f6b59b4fc18f7eca4f93aa28539 100644 --- a/src/os/linux/src/linuxPlatform.c +++ b/src/os/linux/src/linuxPlatform.c @@ -157,7 +157,7 @@ void *taosProcessAlarmSignal(void *tharg) { void (*callback)(int) = tharg; static timer_t timerId; - struct sigevent sevent = {0}; + struct sigevent sevent = {{0}}; #ifdef _ALPINE sevent.sigev_notify = SIGEV_THREAD; diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index f06230c16f1303f0a8bf022e3d65329ed43be0ac..fb25e9dcd976581731ac6e741c843908459edc45 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -161,7 +161,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) { SFileGroup *pFGroup = NULL; SFileGroupIter iter; - SRWHelper rhelper = {0}; + SRWHelper rhelper = {{0}}; if (tsdbInitReadHelper(&rhelper, pRepo) < 0) goto _err; tsdbInitFileGroupIter(pFileH, &iter, TSDB_ORDER_ASC); @@ -948,7 +948,7 @@ static void *tsdbCommitData(void *arg) { STsdbCache *pCache = pRepo->tsdbCache; STsdbCfg * pCfg = &(pRepo->config); SDataCols * pDataCols = NULL; - SRWHelper whelper = {0}; + SRWHelper whelper = {{0}}; if (pCache->imem == NULL) return NULL; tsdbPrint("vgId: %d, starting to commit....", pRepo->config.tsdbId); diff --git a/src/util/src/exception.c b/src/util/src/exception.c index 3d2949c093d47aeb41d4e10cd566ba9975f44457..e1f6516fe7d95de3e9ef986af85ca6923944c2d9 100644 --- a/src/util/src/exception.c +++ b/src/util/src/exception.c @@ -1,7 +1,8 @@ +#include "os.h" #include "exception.h" -static _Thread_local SExceptionNode* expList; +static threadlocal SExceptionNode* expList; void exceptionPushNode( SExceptionNode* node ) { node->prev = expList; @@ -145,4 +146,4 @@ void cleanupExecuteTo( int32_t anchor, bool failed ) { void cleanupExecute( SExceptionNode* node, bool failed ) { doExecuteCleanup( node, 0, failed ); -} \ No newline at end of file +} diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 61ae647bf4a1f4a75c1aa10ed6340eae848b3719..32a3df844c2be3bbbf634af796e56fb2c47a05ed 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -25,7 +25,7 @@ #include "tsystem.h" #include "tutil.h" -SGlobalCfg tsGlobalConfig[TSDB_CFG_MAX_NUM] = {0}; +SGlobalCfg tsGlobalConfig[TSDB_CFG_MAX_NUM] = {{0}}; int32_t tsGlobalConfigNum = 0; static char *tsGlobalUnit[] = { diff --git a/src/util/src/tdes.c b/src/util/src/tdes.c index 6f72dec574f4684bb830e9193a1e30aebfeee565..00474e4ae29a5e6f910a250d48a3c23b95c3826c 100644 --- a/src/util/src/tdes.c +++ b/src/util/src/tdes.c @@ -32,7 +32,7 @@ char* taosDesImp(unsigned char* key, char* src, unsigned int len, int process_mo unsigned int number_of_blocks = len / 8; unsigned char data_block[9] = {0}; unsigned char processed_block[9] = {0}; - key_set key_sets[17] = {0}; + key_set key_sets[17]; memset(key_sets, 0, sizeof(key_sets)); char* dest = calloc(len + 1, 1); generate_sub_keys(key, key_sets); diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 628f7a2d5cc7ae74055162b7fbd22c544ff9509c..c040a11362a01175a126a7d954af4a945285061d 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -27,10 +27,11 @@ typedef struct { } STaosError; +#include "os.h" #include "taoserror.h" -static _Thread_local int32_t tsErrno; +static threadlocal int32_t tsErrno; int32_t* taosGetErrno() { return &tsErrno; }