Skip to content

Commit

Permalink
Remove redundant costly Kleene stars from regex searches
Browse files Browse the repository at this point in the history
Some of the string(REGEX MATCH) operations surround the pattern
with ".*", causing the CMake process to effectively wedge when
trying to match on larger (100KiB) bodies of input.

This commit removes those parts without any change in semantics
as MATCH patterns only need to match the actual match.

This should fix bug STEllAR-GROUP#1040.
  • Loading branch information
zao committed Jan 6, 2014
1 parent f3fbd9b commit b9d4472
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmake/HPX_Compile.cmake
Expand Up @@ -83,12 +83,12 @@ if(NOT CMAKE_CROSSCOMPILING)
)
if(${name}_STDERR)
if("${CMAKE_${${name}_LANGUAGE}_COMPILER_ID}" STREQUAL "Intel")
string(REGEX MATCH ".*command line warning #.*" ${name}_HAS_COMMAND_LINE_WARNING ${${name}_STDERR})
string(REGEX MATCH "command line warning #" ${name}_HAS_COMMAND_LINE_WARNING ${${name}_STDERR})
if(${name}_HAS_COMMAND_LINE_WARNING)
set(${name}_RESULT "1")
endif()
elseif("${CMAKE_${${name}_LANGUAGE}_COMPILER_ID}" STREQUAL "Clang")
string(REGEX MATCH ".*(argument unused during compilation|unknown warning option).*" ${name}_HAS_UNUSED_ARGUMENT_WARNING ${${name}_STDERR})
string(REGEX MATCH "(argument unused during compilation|unknown warning option)" ${name}_HAS_UNUSED_ARGUMENT_WARNING ${${name}_STDERR})
endif()
endif()
file(WRITE ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${name}.${${name}_LANGUAGE}.log ${${name}_STDERR} ${${name}_STDOUT} "\n")
Expand Down Expand Up @@ -120,12 +120,12 @@ else()
if(${name}_RESULT)
set(${name}_RESULT "0")
if("${CMAKE_${${name}_LANGUAGE}_COMPILER_ID}" STREQUAL "Intel")
string(REGEX MATCH ".*command line warning #.*" ${name}_HAS_COMMAND_LINE_WARNING ${${name}_OUT})
string(REGEX MATCH "command line warning #" ${name}_HAS_COMMAND_LINE_WARNING ${${name}_OUT})
if(${name}_HAS_COMMAND_LINE_WARNING)
set(${name}_RESULT "1")
endif()
elseif("${CMAKE_${${name}_LANGUAGE}_COMPILER_ID}" STREQUAL "Clang")
string(REGEX MATCH ".*(argument unused during compilation|unknown warning option).*" ${name}_HAS_UNUSED_ARGUMENT_WARNING ${${name}_OUT})
string(REGEX MATCH "(argument unused during compilation|unknown warning option)" ${name}_HAS_UNUSED_ARGUMENT_WARNING ${${name}_OUT})
endif()
else()
set(${name}_RESULT "1")
Expand Down

0 comments on commit b9d4472

Please sign in to comment.