diff --git a/cmake/define.inc b/cmake/define.inc index 84df6f54055cff0b6fe7f1820d46958787ca3c46..7cc8dc7a26a10584349ba67d560720e5464e58ab 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -48,6 +48,7 @@ ENDIF () IF (TD_LINUX_64) ADD_DEFINITIONS(-D_M_X64) ADD_DEFINITIONS(-D_TD_LINUX_64) + MESSAGE(STATUS "linux64 is defined") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ADD_DEFINITIONS(-DUSE_LIBICONV) ENDIF () @@ -55,30 +56,35 @@ ENDIF () IF (TD_LINUX_32) ADD_DEFINITIONS(-D_TD_LINUX_32) ADD_DEFINITIONS(-DUSE_LIBICONV) - SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -munaligned-access -fpack-struct=8 -latomic -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") + MESSAGE(STATUS "linux32 is defined") + SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -munaligned-access -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ENDIF () IF (TD_ARM_64) ADD_DEFINITIONS(-D_M_X64) - ADD_DEFINITIONS(-D_TD_ARM_64_) + ADD_DEFINITIONS(-D_TD_ARM_64) ADD_DEFINITIONS(-D_TD_ARM_) ADD_DEFINITIONS(-DUSE_LIBICONV) + MESSAGE(STATUS "arm64 is defined") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ENDIF () IF (TD_ARM_32) - ADD_DEFINITIONS(-D_TD_ARM_32_) + ADD_DEFINITIONS(-D_TD_ARM_32) ADD_DEFINITIONS(-D_TD_ARM_) - SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") + MESSAGE(STATUS "arm32 is defined") + SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types ") ENDIF () IF (TD_MIPS_64) ADD_DEFINITIONS(-D_TD_MIPS_64_) + MESSAGE(STATUS "mips64 is defined") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ENDIF () IF (TD_MIPS_32) ADD_DEFINITIONS(-D_TD_MIPS_32_) + MESSAGE(STATUS "mips32 is defined") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") ENDIF () @@ -86,6 +92,7 @@ IF (TD_APLHINE) SET(COMMON_FLAGS "${COMMON_FLAGS} -largp") link_libraries(/usr/lib/libargp.a) ADD_DEFINITIONS(-D_ALPINE) + MESSAGE(STATUS "aplhine is defined") ENDIF () IF (TD_LINUX) @@ -95,7 +102,7 @@ IF (TD_LINUX) ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT) IF (TD_NINGSI_60) - ADD_DEFINITIONS(-D_TD_NINGSI_60_) + ADD_DEFINITIONS(-D_TD_NINGSI_60) MESSAGE(STATUS "set ningsi macro to true") ENDIF () @@ -118,6 +125,7 @@ IF (TD_DARWIN_64) ADD_DEFINITIONS(-DDARWIN) ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT) ADD_DEFINITIONS(-DUSE_LIBICONV) + MESSAGE(STATUS "darwin64 is defined") SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -g -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE") SET(DEBUG_FLAGS "-O0 -DDEBUG") SET(RELEASE_FLAGS "-O0") @@ -147,11 +155,13 @@ IF (TD_WINDOWS_64) ADD_DEFINITIONS(-D_M_X64) ADD_DEFINITIONS(-D_TD_WINDOWS_64) ADD_DEFINITIONS(-DUSE_LIBICONV) + MESSAGE(STATUS "windows64 is defined") ENDIF () IF (TD_WINDOWS_32) ADD_DEFINITIONS(-D_TD_WINDOWS_32) ADD_DEFINITIONS(-DUSE_LIBICONV) + MESSAGE(STATUS "windows32 is defined") ENDIF () INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) diff --git a/cmake/version.inc b/cmake/version.inc index aa8a4b6463c072b59d54245da4206a6f3b1f351c..52fbe3ca588bac81ec3e98eedbdd039f7b56f57d 100644 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -42,6 +42,12 @@ IF (DEFINED CPUTYPE) ELSE () IF (TD_WINDOWS_32) SET(TD_VER_CPUTYPE "x86") + ELSEIF (TD_LINUX_32) + SET(TD_VER_CPUTYPE "x86") + ELSEIF (TD_ARM_32) + SET(TD_VER_CPUTYPE "x86") + ELSEIF (TD_MIPS_32) + SET(TD_VER_CPUTYPE "x86") ELSE () SET(TD_VER_CPUTYPE "x64") ENDIF () diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index bd980b75a340dac3e76240e62743a8370b39404c..9368faa0ee961fb8af98df2ddaecf1e9e748bd31 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -149,7 +149,7 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_initImp(JNIEnv *e JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *env, jobject jobj, jint optionIndex, jstring optionValue) { if (optionValue == NULL) { - jniDebug("option index:%d value is null", optionIndex); + jniDebug("option index:%d value is null", (int32_t)optionIndex); return 0; } @@ -183,7 +183,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv } (*env)->ReleaseStringUTFChars(env, optionValue, tz1); } else { - jniError("option index:%d is not found", optionIndex); + jniError("option index:%d is not found", (int32_t)optionIndex); } return res; @@ -227,10 +227,10 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn ret = (jlong)taos_connect((char *)host, (char *)user, (char *)pass, (char *)dbname, (uint16_t)jport); if (ret == 0) { jniError("jobj:%p, conn:%p, connect to database failed, host=%s, user=%s, dbname=%s, port=%d", jobj, (void *)ret, - (char *)host, (char *)user, (char *)dbname, jport); + (char *)host, (char *)user, (char *)dbname, (int32_t)jport); } else { jniDebug("jobj:%p, conn:%p, connect to database succeed, host=%s, user=%s, dbname=%s, port=%d", jobj, (void *)ret, - (char *)host, (char *)user, (char *)dbname, jport); + (char *)host, (char *)user, (char *)dbname, (int32_t)jport); } if (host != NULL) (*env)->ReleaseStringUTFChars(env, jhost, host); @@ -385,7 +385,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsIm } jint ret = taos_affected_rows((SSqlObj *)res); - jniDebug("jobj:%p, conn:%p, sql:%p, res: %p, affect rows:%d", jobj, tscon, (void *)con, (void *)res, ret); + jniDebug("jobj:%p, conn:%p, sql:%p, res: %p, affect rows:%d", jobj, tscon, (void *)con, (void *)res, (int32_t)ret); return ret; } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 0a5cfef80a1bd642fb6376712e39369a47e2c798..2e92b671818bf3bd24450e4203e43a7e87fe720c 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -642,14 +642,14 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo)) { - tscError("%p illegal value of numOfCols in query msg: %"PRIu64", table cols:%d", pSql, numOfSrcCols, + tscError("%p illegal value of numOfCols in query msg: %" PRIu64 ", table cols:%d", pSql, (uint64_t)numOfSrcCols, tscGetNumOfColumns(pTableMeta)); return TSDB_CODE_TSC_INVALID_SQL; } if (pQueryInfo->interval.interval < 0) { - tscError("%p illegal value of aggregation time interval in query msg: %ld", pSql, pQueryInfo->interval.interval); + tscError("%p illegal value of aggregation time interval in query msg: %" PRId64, pSql, (int64_t)pQueryInfo->interval.interval); return TSDB_CODE_TSC_INVALID_SQL; } diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 81b8cf7359a93764551cc4765efebc19be4d62ad..d01ede279aaad882e26bada0c8a6bb7069747406 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -398,8 +398,8 @@ static void tscSetSlidingWindowInfo(SSqlObj *pSql, SSqlStream *pStream) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); if (pQueryInfo->interval.intervalUnit != 'n' && pQueryInfo->interval.intervalUnit!= 'y' && pQueryInfo->interval.interval < minIntervalTime) { - tscWarn("%p stream:%p, original sample interval:%ld too small, reset to:%" PRId64, pSql, pStream, - pQueryInfo->interval.interval, minIntervalTime); + tscWarn("%p stream:%p, original sample interval:%" PRId64 " too small, reset to:%" PRId64, pSql, pStream, + (int64_t)pQueryInfo->interval.interval, minIntervalTime); pQueryInfo->interval.interval = minIntervalTime; } diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index e7f40442a0b18c07193a10db61452c820e603473..9c241c5c437507c6c66400a4acc7716f2a479d49 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -313,13 +313,13 @@ void dataColSetOffset(SDataCol *pCol, int nEle) { SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows) { SDataCols *pCols = (SDataCols *)calloc(1, sizeof(SDataCols)); if (pCols == NULL) { - uDebug("malloc failure, size:%"PRId64" failed, reason:%s", sizeof(SDataCols), strerror(errno)); + uDebug("malloc failure, size:%" PRId64 " failed, reason:%s", (int64_t)sizeof(SDataCols), strerror(errno)); return NULL; } pCols->cols = (SDataCol *)calloc(maxCols, sizeof(SDataCol)); if (pCols->cols == NULL) { - uDebug("malloc failure, size:%"PRId64" failed, reason:%s", sizeof(SDataCol) * maxCols, strerror(errno)); + uDebug("malloc failure, size:%" PRId64 " failed, reason:%s", (int64_t)sizeof(SDataCol) * maxCols, strerror(errno)); tdFreeDataCols(pCols); return NULL; } @@ -331,7 +331,7 @@ SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows) { pCols->buf = malloc(pCols->bufSize); if (pCols->buf == NULL) { - uDebug("malloc failure, size:%"PRId64" failed, reason:%s", sizeof(SDataCol) * maxCols, strerror(errno)); + uDebug("malloc failure, size:%" PRId64 " failed, reason:%s", (int64_t)sizeof(SDataCol) * maxCols, strerror(errno)); tdFreeDataCols(pCols); return NULL; } @@ -716,4 +716,4 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder) { memcpy(kvRowValues(row), pBuilder->buf, pBuilder->size); return row; -} \ No newline at end of file +} diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index ff417b6cdef4c60dc8d563800a2b2d4c92c8d0c3..45ec20ce4533c6bf9a81b045f6f07f02bbe53121 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -235,7 +235,7 @@ static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t num double csum = 0; csum = GET_DOUBLE_VAL(sum); csum += dsum; -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 SET_DOUBLE_VAL_ALIGN(sum, &csum); SET_DOUBLE_VAL_ALIGN(max, &fmax); SET_DOUBLE_VAL_ALIGN(min, &fmin); @@ -282,7 +282,7 @@ static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t num csum += dsum; -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 SET_DOUBLE_VAL_ALIGN(sum, &csum); SET_DOUBLE_VAL_ALIGN(max, &dmax); SET_DOUBLE_VAL_ALIGN(min, &dmin); @@ -494,7 +494,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { break; } case TSDB_DATA_TYPE_FLOAT: { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 float fv = GET_FLOAT_VAL(src); SET_FLOAT_VAL_ALIGN(val, &fv); #else @@ -503,7 +503,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { break; }; case TSDB_DATA_TYPE_DOUBLE: { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 double dv = GET_DOUBLE_VAL(src); SET_DOUBLE_VAL_ALIGN(val, &dv); #else diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 069d8eb2517cbbd70477652140294fb3b3863906..ba118d2ccb05152b3d59dcc53fcb81ac0b4b62ce 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -709,7 +709,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu return -1; } -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 //memcpy(&payload, &value, sizeof(float)); float fv = (float)value; SET_FLOAT_VAL_ALIGN(payload, &fv); @@ -718,7 +718,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu #endif } } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 //memcpy(&payload, &pVariant->i64Key, sizeof(float)); float fv = (float)pVariant->i64Key; SET_FLOAT_VAL_ALIGN(payload, &fv); @@ -726,7 +726,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu *((float *)payload) = (float)pVariant->i64Key; #endif } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 //memcpy(&payload, &pVariant->dKey, sizeof(float)); float fv = (float)pVariant->dKey; SET_FLOAT_VAL_ALIGN(payload, &fv); @@ -738,7 +738,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu return 0; } -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 float fv = GET_FLOAT_VAL(payload); if (isinf(fv) || isnan(fv) || fv > FLT_MAX || fv < -FLT_MAX) { return -1; @@ -765,21 +765,21 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu return -1; } -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 SET_DOUBLE_VAL_ALIGN(payload, &value); #else *((double *)payload) = value; #endif } } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 double dv = (double)(pVariant->i64Key); SET_DOUBLE_VAL_ALIGN(payload, &dv); #else *((double *)payload) = (double)pVariant->i64Key; #endif } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 double dv = (double)(pVariant->dKey); SET_DOUBLE_VAL_ALIGN(payload, &dv); #else @@ -790,7 +790,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu return 0; } -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 double dv = GET_DOUBLE_VAL(payload); if (isinf(dv) || isnan(dv) || dv > DBL_MAX || dv < -DBL_MAX) { return -1; diff --git a/src/connector/go b/src/connector/go index 8d7bf743852897110cbdcc7c4322cd7a74d4167b..06ec30a0f1762e8169bf6b9045c82bcaa52bcdf0 160000 --- a/src/connector/go +++ b/src/connector/go @@ -1 +1 @@ -Subproject commit 8d7bf743852897110cbdcc7c4322cd7a74d4167b +Subproject commit 06ec30a0f1762e8169bf6b9045c82bcaa52bcdf0 diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 228aba2a5e57cc362ffb3af54a81093328e047b5..f636cde8e5bc66314152a74a91a005551f4b9ec1 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -131,7 +131,7 @@ do { \ #define GET_INT16_VAL(x) (*(int16_t *)(x)) #define GET_INT32_VAL(x) (*(int32_t *)(x)) #define GET_INT64_VAL(x) (*(int64_t *)(x)) -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 #define GET_FLOAT_VAL(x) taos_align_get_float(x) #define GET_DOUBLE_VAL(x) taos_align_get_double(x) diff --git a/src/os/inc/os.h b/src/os/inc/os.h index d4b71173a07fe2c36ee1479bc94bbf274b8dd6b6..86e16db8b1446308060945d3a7db2531287c62ec 100644 --- a/src/os/inc/os.h +++ b/src/os/inc/os.h @@ -24,10 +24,14 @@ extern "C" { #include "osDarwin.h" #endif -#ifdef _TD_ARM_64_ +#ifdef _TD_ARM_64 #include "osArm64.h" #endif +#ifdef _TD_ARM_32 +#include "osArm32.h" +#endif + #ifdef _TD_LINUX_64 #include "osLinux64.h" #endif @@ -40,7 +44,7 @@ extern "C" { #include "osAlpine.h" #endif -#ifdef _TD_NINGSI_60_ +#ifdef _TD_NINGSI_60 #include "osNingsi.h" #endif diff --git a/src/os/inc/osArm32.h b/src/os/inc/osArm32.h new file mode 100644 index 0000000000000000000000000000000000000000..17b4d2dbd53fbc516900bf9aa2db69e7f44dace0 --- /dev/null +++ b/src/os/inc/osArm32.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_OS_ARM32_H +#define TDENGINE_OS_ARM32_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TAOS_OS_FUNC_LZ4 + #define BUILDIN_CLZL(val) __builtin_clzll(val) + #define BUILDIN_CTZL(val) __builtin_ctzll(val) + #define BUILDIN_CLZ(val) __builtin_clz(val) + #define BUILDIN_CTZ(val) __builtin_ctz(val) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/os/inc/osNingsi.h b/src/os/inc/osNingsi.h index da7f796b595cf9303d6e178da46368f552030edd..d88d2797455e5c3357bee81cdf9414146a38cd08 100644 --- a/src/os/inc/osNingsi.h +++ b/src/os/inc/osNingsi.h @@ -129,8 +129,6 @@ void* atomic_exchange_ptr_impl( void **ptr, void *val ); #define atomic_fetch_xor_64(ptr, val) __sync_fetch_and_xor((ptr), (val)) #define atomic_fetch_xor_ptr(ptr, val) __sync_fetch_and_xor((ptr), (val)) - - #ifdef __cplusplus } #endif diff --git a/src/os/inc/osWindows.h b/src/os/inc/osWindows.h index d4f3d6d2afd94bcfd2527af9927bf188ba4bf0de..dc1da35037dc06c258856a1a143146492eeed0e5 100644 --- a/src/os/inc/osWindows.h +++ b/src/os/inc/osWindows.h @@ -51,8 +51,6 @@ extern "C" { #endif -#define TAOS_OS_FUNC_ATOMIC - #define TAOS_OS_FUNC_LZ4 int32_t BUILDIN_CLZL(uint64_t val); int32_t BUILDIN_CLZ(uint32_t val); @@ -351,4 +349,4 @@ void wordfree(wordexp_t *pwordexp); #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index afb89354536f03d4a467fa16e20a7fe25794ade2..0d5c130d6eddce07b967e3fe15762f01d6e1e97b 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -9,3 +9,7 @@ SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w) ADD_LIBRARY(osdetail ${SRC}) TARGET_LINK_LIBRARIES(osdetail os) + +IF (TD_ARM_32 OR TD_LINUX_32) + TARGET_LINK_LIBRARIES(osdetail atomic) +ENDIF () diff --git a/src/os/src/detail/osSysinfo.c b/src/os/src/detail/osSysinfo.c index 83ecd8580946db628e7a785b5becca87db23118c..f6470fc3e1e84e38013d963d4ea2d3a2ae58833b 100644 --- a/src/os/src/detail/osSysinfo.c +++ b/src/os/src/detail/osSysinfo.c @@ -569,7 +569,6 @@ int taosSystem(const char *cmd) { } } -int _sysctl(struct __sysctl_args *args ); void taosSetCoreDump() { if (0 == tsEnableCoreFile) { return; diff --git a/src/os/src/linux/ningsi.c b/src/os/src/linux/ningsi.c index 793ccac84adc05988c9fbb0b6b1d13170752c76a..2514c38ece835630c8bfbf7714868701c193d116 100644 --- a/src/os/src/linux/ningsi.c +++ b/src/os/src/linux/ningsi.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" -#ifdef _TD_NINGSI_60_ +#ifdef _TD_NINGSI_60 void* atomic_exchange_ptr_impl(void** ptr, void* val ) { void *old; do { diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index 6abd382f8e5a3ff75c1296cd5c4e2bea533ec53f..ec60b984b2b0fcc72367295cef9d956165e678d5 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -67,7 +67,7 @@ static void httpDestroyContext(void *data) { } bool httpInitContexts() { - tsHttpServer.contextCache = taosCacheInit(TSDB_DATA_TYPE_BIGINT, 2, true, httpDestroyContext, "restc"); + tsHttpServer.contextCache = taosCacheInit(TSDB_CACHE_PTR_KEY, 2, true, httpDestroyContext, "restc"); if (tsHttpServer.contextCache == NULL) { httpError("failed to init context cache"); return false; @@ -117,8 +117,9 @@ HttpContext *httpCreateContext(int32_t fd) { pContext->state = HTTP_CONTEXT_STATE_READY; pContext->parser = httpCreateParser(pContext); - uint64_t handleVal = (uint64_t)pContext; - HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, &handleVal, sizeof(int64_t), &pContext, sizeof(int64_t), 3000); + TSDB_CACHE_PTR_TYPE handleVal = (TSDB_CACHE_PTR_TYPE)pContext; + HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, &handleVal, sizeof(TSDB_CACHE_PTR_TYPE), &pContext, + sizeof(TSDB_CACHE_PTR_TYPE), 3000); pContext->ppContext = ppContext; httpDebug("context:%p, fd:%d, is created, data:%p", pContext, fd, ppContext); @@ -129,8 +130,8 @@ HttpContext *httpCreateContext(int32_t fd) { } HttpContext *httpGetContext(void *ptr) { - uint64_t handleVal = (uint64_t)ptr; - HttpContext **ppContext = taosCacheAcquireByKey(tsHttpServer.contextCache, &handleVal, sizeof(HttpContext *)); + TSDB_CACHE_PTR_TYPE handleVal = (TSDB_CACHE_PTR_TYPE)ptr; + HttpContext **ppContext = taosCacheAcquireByKey(tsHttpServer.contextCache, &handleVal, sizeof(TSDB_CACHE_PTR_TYPE)); if (ppContext) { HttpContext *pContext = *ppContext; diff --git a/src/plugins/http/src/httpGcJson.c b/src/plugins/http/src/httpGcJson.c index a291641dc376c6d581a137403a1ac623ce9dd5ec..fde8ae2176007b1f042393d8d1fc112198c3ff64 100644 --- a/src/plugins/http/src/httpGcJson.c +++ b/src/plugins/http/src/httpGcJson.c @@ -145,7 +145,7 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%d,", fields[i].name, *((int32_t *)row[i])); break; case TSDB_DATA_TYPE_BIGINT: - len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%ld", fields[i].name, *((int64_t *)row[i])); + len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%" PRId64, fields[i].name, *((int64_t *)row[i])); break; case TSDB_DATA_TYPE_FLOAT: len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%.5f", fields[i].name, *((float *)row[i])); diff --git a/src/plugins/http/src/httpJson.c b/src/plugins/http/src/httpJson.c index 7600fb3e43af236c59a5afea0a4ad981019b2b32..1aa6cfac4bf9414e6aa8004ca1bb120b2d40feba 100644 --- a/src/plugins/http/src/httpJson.c +++ b/src/plugins/http/src/httpJson.c @@ -113,7 +113,7 @@ int32_t httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) { httpTrace("context:%p, fd:%d, no data need dump", buf->pContext, buf->pContext->fd); return 0; // there is no data to dump. } else { - int32_t len = sprintf(sLen, "%lx\r\n", srcLen); + int32_t len = sprintf(sLen, "%" PRIx64 "\r\n", srcLen); httpTrace("context:%p, fd:%d, write body, chunkSize:%" PRIu64 ", response:\n%s", buf->pContext, buf->pContext->fd, srcLen, buf->buf); httpWriteBufNoTrace(buf->pContext, sLen, len); @@ -267,9 +267,9 @@ void httpJsonTimestamp(JsonBuf* buf, int64_t t, bool us) { ptm = localtime(&tt); int32_t length = (int32_t) strftime(ts, 35, "%Y-%m-%d %H:%M:%S", ptm); if (us) { - length += snprintf(ts + length, 8, ".%06ld", t % precision); + length += snprintf(ts + length, 8, ".%06" PRId64, t % precision); } else { - length += snprintf(ts + length, 5, ".%03ld", t % precision); + length += snprintf(ts + length, 5, ".%03" PRId64, t % precision); } httpJsonString(buf, ts, length); @@ -287,9 +287,9 @@ void httpJsonUtcTimestamp(JsonBuf* buf, int64_t t, bool us) { ptm = localtime(&tt); int32_t length = (int32_t)strftime(ts, 40, "%Y-%m-%dT%H:%M:%S", ptm); if (us) { - length += snprintf(ts + length, 8, ".%06ld", t % precision); + length += snprintf(ts + length, 8, ".%06" PRId64, t % precision); } else { - length += snprintf(ts + length, 5, ".%03ld", t % precision); + length += snprintf(ts + length, 5, ".%03" PRId64, t % precision); } length += (int32_t)strftime(ts + length, 40 - length, "%z", ptm); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index f2d324e376390e27252c22af0d8c07b5e587b20a..d4c1c8560b3ae0351141e4ca5166171efc70cc52 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -5050,8 +5050,8 @@ static void sequentialTableProcess(SQInfo *pQInfo) { } qDebug( - "QInfo %p numOfTables:%"PRIu64", index:%d, numOfGroups:%" PRIzu ", %"PRId64" points returned, total:%"PRId64", offset:%" PRId64, - pQInfo, pQInfo->tableqinfoGroupInfo.numOfTables, pQInfo->tableIndex, numOfGroups, pQuery->rec.rows, pQuery->rec.total, + "QInfo %p numOfTables:%" PRIu64 ", index:%d, numOfGroups:%" PRIzu ", %" PRId64 " points returned, total:%" PRId64 ", offset:%" PRId64, + pQInfo, (uint64_t)pQInfo->tableqinfoGroupInfo.numOfTables, pQInfo->tableIndex, numOfGroups, pQuery->rec.rows, pQuery->rec.total, pQuery->limit.offset); } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 50b1507a56f8923f507b225838717a62a1e8c9bd..f0b8c996c5aec747e69785c469946f80856e05e5 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -240,7 +240,7 @@ void *rpcOpen(const SRpcInit *pInit) { size_t size = sizeof(SRpcConn) * pRpc->sessions; pRpc->connList = (SRpcConn *)calloc(1, size); if (pRpc->connList == NULL) { - tError("%s failed to allocate memory for taos connections, size:%ld", pRpc->label, size); + tError("%s failed to allocate memory for taos connections, size:%" PRId64, pRpc->label, (int64_t)size); rpcClose(pRpc); return NULL; } diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index 8e24aed8f789f03ef324c05922c38ecefe747256..4ea47582b9c93fbd483454a50e1bf6aed5237870 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -211,7 +211,7 @@ static void *taosRecvUdpData(void *param) { char *tmsg = malloc(dataLen + tsRpcOverhead); if (NULL == tmsg) { - tError("%s failed to allocate memory, size:%ld", pConn->label, dataLen); + tError("%s failed to allocate memory, size:%" PRId64, pConn->label, (int64_t)dataLen); continue; } else { tDebug("UDP malloc mem: %p", tmsg); diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index 6d0b847afee7679783c05645e1ea762b89338630..60625d75eccdbe6bbb29f97b31ecd8e9855480a7 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -325,7 +325,7 @@ static int syncProcessLastWal(SSyncPeer *pPeer, char *wname, uint32_t index) { // if all data up to fversion is read out, it is over if (pPeer->sversion >= fversion && fversion > 0) { code = 0; - sDebug("%s, data up to fversion:%ld has been read out, bytes:%d", pPeer->id, fversion, bytes); + sDebug("%s, data up to fversion:%" PRId64 " has been read out, bytes:%d", pPeer->id, fversion, bytes); break; } diff --git a/src/sync/test/syncServer.c b/src/sync/test/syncServer.c index 8e769a461e1b1d6c995cc64b3a4cd6dfc0dd4172..aa07779845bfaea3195a05b91a0ee75b9946f2a7 100644 --- a/src/sync/test/syncServer.c +++ b/src/sync/test/syncServer.c @@ -386,7 +386,7 @@ int main(int argc, char *argv[]) { printf(" [-m msgSize]: message body size, default is:%d\n", msgSize); printf(" [-o compSize]: compression message size, default is:%d\n", tsCompressMsgSize); printf(" [-w write]: write received data to file(0, 1, 2), default is:%d\n", commit); - printf(" [-v version]: initial node version, default is:%ld\n", syncInfo.version); + printf(" [-v version]: initial node version, default is:%" PRId64 "\n", syncInfo.version); printf(" [-r replica]: replicacation number, default is:%d\n", pCfg->replica); printf(" [-q quorum]: quorum, default is:%d\n", pCfg->quorum); printf(" [-d debugFlag]: debug flag, default:%d\n", rpcDebugFlag); diff --git a/src/util/inc/tcache.h b/src/util/inc/tcache.h index af5f30c7c3858ee37af253589cdd5e4323ad1d69..efd51f90ce8739050971856dd4f2dbdd1c44d5a4 100644 --- a/src/util/inc/tcache.h +++ b/src/util/inc/tcache.h @@ -24,6 +24,14 @@ extern "C" { #include "tlockfree.h" #include "hash.h" +#if defined(_TD_ARM_32) + #define TSDB_CACHE_PTR_KEY TSDB_DATA_TYPE_INT + #define TSDB_CACHE_PTR_TYPE int32_t +#else + #define TSDB_CACHE_PTR_KEY TSDB_DATA_TYPE_BIGINT + #define TSDB_CACHE_PTR_TYPE int64_t +#endif + typedef void (*__cache_free_fn_t)(void*); typedef struct SCacheStatis { diff --git a/src/util/src/hash.c b/src/util/src/hash.c index 7427a2e4f345887888afe6a6e2901ef8e0d21252..625d4af1ac981c5d1f5f079f5b15533a4d63ef24 100644 --- a/src/util/src/hash.c +++ b/src/util/src/hash.c @@ -738,7 +738,7 @@ void taosHashTableResize(SHashObj *pHashObj) { int64_t et = taosGetTimestampUs(); - uDebug("hash table resize completed, new capacity:%"PRId64", load factor:%f, elapsed time:%fms", pHashObj->capacity, + uDebug("hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms", (int32_t)pHashObj->capacity, ((double)pHashObj->size) / pHashObj->capacity, (et - st) / 1000.0); } diff --git a/src/wal/test/waltest.c b/src/wal/test/waltest.c index 073dbf72af02437dc494fdf18ceeebaa24777dca..bbee1347b8f92aa6cfad448fdfb369de8f5a6301 100644 --- a/src/wal/test/waltest.c +++ b/src/wal/test/waltest.c @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { printf(" [-t total]: total wal files, default is:%d\n", total); printf(" [-r rows]: rows of records per wal file, default is:%d\n", rows); printf(" [-k keep]: keep the wal after closing, default is:%d\n", keep); - printf(" [-v version]: initial version, default is:%ld\n", ver); + printf(" [-v version]: initial version, default is:%" PRId64 "\n", ver); printf(" [-d debugFlag]: debug flag, default:%d\n", dDebugFlag); printf(" [-h help]: print out this help\n\n"); exit(0); @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) { exit(-1); } - printf("version starts from:%ld\n", ver); + printf("version starts from:%" PRId64 "\n", ver); int contLen = sizeof(SWalHead) + size; SWalHead *pHead = (SWalHead *) malloc(contLen); diff --git a/tests/comparisonTest/tdengine/tdengineTest.c b/tests/comparisonTest/tdengine/tdengineTest.c index 3d78a3d0a54ac571aceb13c1bb9a6f133589bd86..237403f52565c1b68b21e895d5555a2a673bb5f7 100644 --- a/tests/comparisonTest/tdengine/tdengineTest.c +++ b/tests/comparisonTest/tdengine/tdengineTest.c @@ -278,7 +278,7 @@ void writeData() { free(threads); - printf("---- Spent %f seconds to insert %ld records, speed: %f Rows/Second\n", seconds, statis.totalRows, rs); + printf("---- Spent %f seconds to insert %" PRId64 " records, speed: %f Rows/Second\n", seconds, statis.totalRows, rs); } void readDataImp(void *param) diff --git a/tests/examples/c/demo.c b/tests/examples/c/demo.c index f0e970c3325346eb5ebd341dae8fcbc7d968a8c2..d64c0de1ce45597e26396979bb693cc0f96873d5 100644 --- a/tests/examples/c/demo.c +++ b/tests/examples/c/demo.c @@ -19,6 +19,7 @@ #include #include #include +#include #include // TAOS header file int main(int argc, char *argv[]) { @@ -67,7 +68,7 @@ int main(int argc, char *argv[]) { // insert 10 records int i = 0; for (i = 0; i < 10; ++i) { - sprintf(qstr, "insert into m1 values (%ld, %d, %d, %d, %d, %f, %lf, '%s')", 1546300800000 + i * 1000, i, i, i, i*10000000, i*1.0, i*2.0, "hello"); + sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", 1546300800000 + i * 1000, i, i, i, i*10000000, i*1.0, i*2.0, "hello"); printf("qstr: %s\n", qstr); if (taos_query(taos, qstr)) { printf("insert row: %i, reason:%s\n", i, taos_errstr(taos)); diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 463dc33c7cc4f73e888fe5583b8311102fdd41b1..4bb0cbe86f2186a7a94ee256822935296721d00a 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -751,7 +751,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { sprintf(value, "%" PRId64, *((int64_t *)row[i])); break; case TSDB_DATA_TYPE_FLOAT:{ -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 float fv = 0; *(int32_t*)(&fv) = *(int32_t*)row[i]; sprintf(value, "%.5f", fv); @@ -761,7 +761,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { } break; case TSDB_DATA_TYPE_DOUBLE: { -#ifdef _TD_ARM_32_ +#ifdef _TD_ARM_32 double dv = 0; *(int64_t*)(&dv) = *(int64_t*)row[i]; sprintf(value, "%.9lf", dv);