From ce393e4d2d995ad5d99bf1cc59851583aead1c47 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 13 Dec 2020 23:03:13 +0800 Subject: [PATCH] add release compile flags --- cmake/define.inc | 2 +- cmake/env.inc | 2 ++ src/client/src/tscLocal.c | 2 +- src/common/src/tvariant.c | 2 +- src/plugins/http/src/httpServer.c | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/define.inc b/cmake/define.inc index 8c3344d493..0c7714c03e 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -106,7 +106,7 @@ IF (TD_LINUX) ENDIF () SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG") - SET(RELEASE_FLAGS "-Og -Wno-unused-variable -Wunused-but-set-variable") + SET(RELEASE_FLAGS "-Og -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -Wno-format-truncation -Wno-maybe-uninitialized -Wno-format-overflow") IF (${COVER} MATCHES "true") MESSAGE(STATUS "Test coverage mode, add extra flags") diff --git a/cmake/env.inc b/cmake/env.inc index 18a6fea51d..efcc996176 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -41,8 +41,10 @@ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${COMMON_FLAGS} ${RELEASE_FL # SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COMMON_CXX_FLAGS} ${RELEASE_FLAGS}") IF (${CMAKE_BUILD_TYPE} MATCHES "Debug") + SET(CMAKE_BUILD_TYPE "Debug") MESSAGE(STATUS "Build Debug Version") ELSEIF (${CMAKE_BUILD_TYPE} MATCHES "Release") + SET(CMAKE_BUILD_TYPE "Release") MESSAGE(STATUS "Build Release Version") ELSE () IF (TD_WINDOWS) diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 4c28adc261..bd444a1231 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -571,7 +571,7 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch return TSDB_CODE_TSC_OUT_OF_MEMORY; } - char fullName[TSDB_TABLE_FNAME_LEN] = {0}; + char fullName[TSDB_TABLE_FNAME_LEN * 2] = {0}; extractDBName(pTableMetaInfo->name, fullName); extractTableName(pMeta->sTableId, param->sTableName); snprintf(fullName + strlen(fullName), TSDB_TABLE_FNAME_LEN - strlen(fullName), ".%s", param->sTableName); diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index fc00f50a7a..571ec2e0dd 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -705,7 +705,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu *((int32_t *)payload) = TSDB_DATA_FLOAT_NULL; return 0; } else { - double value; + double value = -1; int32_t ret; ret = convertToDouble(pVariant->pz, pVariant->nLen, &value); if ((errno == ERANGE && (float)value == -1) || (ret != 0)) { diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 4896d50c6c..1d6c9c2a7e 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -256,7 +256,7 @@ bool httpInitConnect() { HttpThread *pThread = pServer->pThreads; for (int32_t i = 0; i < pServer->numOfThreads; ++i) { - sprintf(pThread->label, "%s%d", pServer->label, i); + snprintf(pThread->label, HTTP_LABEL_SIZE, "%s%d", pServer->label, i); pThread->processData = pServer->processData; pThread->threadId = i; -- GitLab