diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index ef41288a8..80be74af4 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -73,6 +73,13 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") MESSAGE( FATAL_ERROR "Clang++ not found. " ) endif() + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-four-char-constants") + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-missing-braces") + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-missing-field-initializers") + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-multichar") + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-sign-compare") + set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-unused-function") + if(ENABLE_COVERAGE OR ENABLE_COVERAGE_XML) MESSAGE(FATAL_ERROR "Not use clang for generate code coverage. Use gcc. ") endif() @@ -94,7 +101,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "c++-analyzer" ) if(WARNINGS_ANSI_ISO) - set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wextra -pedantic") + set(EXTRA_C_FLAGS "-Wextra -pedantic ${EXTRA_C_FLAGS}") # set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wlogical-op") set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long") # Don't warn about long long usage. endif() @@ -103,7 +110,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") endif() - set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall -std=c++0x") + set(EXTRA_C_FLAGS "-Wall -std=c++0x ${EXTRA_C_FLAGS}") set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0") diff --git a/lib/token.cpp b/lib/token.cpp index 43ab57d67..0b958af42 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -1432,6 +1432,9 @@ void Token::printValueFlow(bool xml, std::ostream &out) const case ValueFlow::Value::CONTAINER_SIZE: out << "container-size=\"" << value.intvalue << '\"'; break; + case ValueFlow::Value::LIFETIME: + out << "lifetime=\"" << value.tokvalue << '\"'; + break; } if (value.condition) out << " condition-line=\"" << value.condition->linenr() << '\"'; @@ -1469,6 +1472,9 @@ void Token::printValueFlow(bool xml, std::ostream &out) const case ValueFlow::Value::CONTAINER_SIZE: out << "size=" << value.intvalue; break; + case ValueFlow::Value::LIFETIME: + out << "lifetime=" << value.tokvalue->str(); + break; } } }