mirror of https://github.com/google/benchmark.git
Merge pull request #58 from google/zero_null
Fix #50 by using nullptr and adding stricter warning.
This commit is contained in:
commit
8eac5dc328
|
@ -37,6 +37,7 @@ add_cxx_compiler_flag(-Wall)
|
|||
add_cxx_compiler_flag(-Wshadow)
|
||||
add_cxx_compiler_flag(-Werror)
|
||||
add_cxx_compiler_flag(-pedantic-errors)
|
||||
add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
|
||||
|
||||
# Release flags
|
||||
add_cxx_compiler_flag(-fno-strict-aliasing RELEASE)
|
||||
|
|
|
@ -22,13 +22,18 @@ function(cxx_feature_check FILE)
|
|||
string(TOUPPER ${FILE} VAR)
|
||||
string(TOUPPER "HAVE_${VAR}" FEATURE)
|
||||
message("-- Performing Test ${FEATURE}")
|
||||
try_run(RUN_${FEATURE} COMPILE_${FEATURE} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp)
|
||||
try_run(RUN_${FEATURE} COMPILE_${FEATURE}
|
||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp)
|
||||
if(RUN_${FEATURE} EQUAL 0)
|
||||
message("-- Performing Test ${FEATURE} -- Success")
|
||||
message("-- Performing Test ${FEATURE} -- success")
|
||||
set(HAVE_${VAR} 1 PARENT_SCOPE)
|
||||
add_definitions(-DHAVE_${VAR})
|
||||
else()
|
||||
message("-- Performing Test ${FEATURE} -- Failed")
|
||||
if(NOT COMPILE_${FEATURE})
|
||||
message("-- Performing Test ${FEATURE} -- failed to compile")
|
||||
else()
|
||||
message("-- Performing Test ${FEATURE} -- compiled but failed to run")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ int main() {
|
|||
if (ec != 0) {
|
||||
return ec;
|
||||
}
|
||||
return regexec(&re, str.c_str(), 0, NULL, 0) ? -1 : 0;
|
||||
return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ int main() {
|
|||
if (ec != 0) {
|
||||
return ec;
|
||||
}
|
||||
return regexec(&re, str.c_str(), 0, NULL, 0) ? -1 : 0;
|
||||
return regexec(&re, str.c_str(), 0, nullptr, 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#include <string>
|
||||
int main() {
|
||||
const std::string str = "test0159";
|
||||
const std::regex re("^[a-z]+[0-9]+$", std::regex_constants::extended | std::regex_constants::nosubs);
|
||||
const std::regex re(
|
||||
"^[a-z]+[0-9]+$",
|
||||
std::regex_constants::extended | std::regex_constants::nosubs);
|
||||
return std::regex_search(str, re) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue