msvc: use the vectorcall calling convention

This requires declaring external interfaces with the cdecl
calling convention.
This commit is contained in:
Matthew Barr
2017-03-10 15:48:38 +11:00
parent 73765f1f84
commit dba2470ec9
19 changed files with 271 additions and 207 deletions

View File

@@ -30,12 +30,41 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds")
endif()
add_library(gtest STATIC ${gtest_SOURCES})
add_definitions(-DGTEST_HAS_PTHREAD=0 -DSRCDIR=${PROJECT_SOURCE_DIR})
set(unit_hyperscan_SOURCES
${gtest_SOURCES}
hyperscan/allocators.cpp
hyperscan/arg_checks.cpp
hyperscan/bad_patterns.cpp
hyperscan/bad_patterns.txt
hyperscan/behaviour.cpp
hyperscan/expr_info.cpp
hyperscan/extparam.cpp
hyperscan/identical.cpp
hyperscan/main.cpp
hyperscan/multi.cpp
hyperscan/order.cpp
hyperscan/scratch_op.cpp
hyperscan/scratch_in_use.cpp
hyperscan/serialize.cpp
hyperscan/single.cpp
hyperscan/som.cpp
hyperscan/stream_op.cpp
hyperscan/test_util.cpp
hyperscan/test_util.h
)
add_executable(unit-hyperscan ${unit_hyperscan_SOURCES})
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
target_link_libraries(unit-hyperscan hs_shared expressionutil)
else()
target_link_libraries(unit-hyperscan hs expressionutil)
endif()
if (NOT (RELEASE_BUILD OR FAT_RUNTIME))
set(unit_internal_SOURCES
${gtest_SOURCES}
internal/bitfield.cpp
internal/bitutils.cpp
internal/charreach.cpp
@@ -83,40 +112,13 @@ set(unit_internal_SOURCES
internal/util_string.cpp
internal/vermicelli.cpp
internal/main.cpp
)
)
add_executable(unit-internal ${unit_internal_SOURCES})
target_link_libraries(unit-internal hs gtest corpusomatic)
set_target_properties(unit-internal PROPERTIES COMPILE_FLAGS "${HS_CXX_FLAGS}")
target_link_libraries(unit-internal hs corpusomatic)
endif(NOT (RELEASE_BUILD OR FAT_RUNTIME))
set(unit_hyperscan_SOURCES
hyperscan/allocators.cpp
hyperscan/arg_checks.cpp
hyperscan/bad_patterns.cpp
hyperscan/bad_patterns.txt
hyperscan/behaviour.cpp
hyperscan/expr_info.cpp
hyperscan/extparam.cpp
hyperscan/identical.cpp
hyperscan/main.cpp
hyperscan/multi.cpp
hyperscan/order.cpp
hyperscan/scratch_op.cpp
hyperscan/scratch_in_use.cpp
hyperscan/serialize.cpp
hyperscan/single.cpp
hyperscan/som.cpp
hyperscan/stream_op.cpp
hyperscan/test_util.cpp
hyperscan/test_util.h
)
add_executable(unit-hyperscan ${unit_hyperscan_SOURCES})
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
target_link_libraries(unit-hyperscan hs_shared gtest expressionutil)
else()
target_link_libraries(unit-hyperscan hs gtest expressionutil)
endif()
#
# build target to run unit tests
#

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -27,9 +27,10 @@
*/
#include "gtest/gtest.h"
#include "hs_common.h"
// Driver: run all the tests (defined in other source files in this directory)
int main(int argc, char **argv) {
int HS_CDECL main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -117,6 +117,6 @@ INSTANTIATE_TEST_CASE_P(ValidUtf8, ValidUtf8Test, ValuesIn(valid_utf8_tests));
TEST_P(ValidUtf8Test, check) {
const auto &info = GetParam();
ASSERT_EQ(info.is_valid, isValidUtf8(info.str.c_str()))
<< "String is: " << printable(info.str) << std::endl;
SCOPED_TRACE(testing::Message() << "String is: " << printable(info.str));
ASSERT_EQ(info.is_valid, isValidUtf8(info.str.c_str()));
}