diff options
author | Jack Lloyd <[email protected]> | 2017-01-24 19:38:02 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-01-24 19:38:02 -0500 |
commit | 53d69ce19b02051cbf732af00ab98bcf384561cd (patch) | |
tree | 9257233777f7ab0eb2f1f2411bd363700ad30429 /src/tests/test_os_utils.cpp | |
parent | b49eaee216142ad6eab5ad437aea44b7897baf84 (diff) |
Fix various SunCC and Solaris warnings and build problems.
Based on build output sent by @noloader.
If RLIMIT_MEMLOCK is not defined, assume regular user is not able to
call mlock. This probably also affected Clang/GCC on Solaris.
Work around resolution issue in SIMD_4x32 where it finds ambiguity
between arg taking uint32_t and __m128i. This is probably some
artifact of how SunCC represents vector types, and seems highly bogus
in general but is easy to work around here. Change constructor taking
a single value to instead be `SIMD_4x32::splat` function. The SIMD
class is internal, so no API implications.
Fix various warnings about lambda functions that were missing return
types and which were not a single return statement. AIUI C++11 doesn't
guarantee that lambda return type will be deduced in that situation,
though in practice every compiler including SunCC seems to handle it.
Disable AVX2 usage, since SunCC's intrinsics seem to be broken - its
_mm_loadu_si256 takes non-const pointer.
Rename a few variables in the tests to avoid shadowed var warnings.
Diffstat (limited to 'src/tests/test_os_utils.cpp')
-rw-r--r-- | src/tests/test_os_utils.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tests/test_os_utils.cpp b/src/tests/test_os_utils.cpp index e7313256e..bdcbf2a90 100644 --- a/src/tests/test_os_utils.cpp +++ b/src/tests/test_os_utils.cpp @@ -25,7 +25,7 @@ int run_cpu_instruction_probe(std::function<int ()> probe_fn); class OS_Utils_Tests : public Test { public: - std::vector<Test::Result> run() + std::vector<Test::Result> run() override { std::vector<Test::Result> results; @@ -106,11 +106,11 @@ class OS_Utils_Tests : public Test #if defined(BOTAN_TARGET_OS_TYPE_IS_UNIX) // OS::run_cpu_instruction_probe only implemented for Unix signals right now - std::function<int ()> ok_fn = []() { return 5; }; + std::function<int ()> ok_fn = []() -> int { return 5; }; const int run_rc = Botan::OS::run_cpu_instruction_probe(ok_fn); result.confirm("Correct result returned by working probe fn", run_rc == 5); - std::function<int ()> throw_fn = []() { throw 3.14159; return 5; }; + std::function<int ()> throw_fn = []() -> int { throw 3.14159; return 5; }; const int throw_rc = Botan::OS::run_cpu_instruction_probe(throw_fn); result.confirm("Error return if probe function threw exception", throw_rc < 0); @@ -119,11 +119,11 @@ class OS_Utils_Tests : public Test std::function<int ()> crash_probe; #if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) - crash_probe = []() { asm volatile("ud2"); return 3; }; + crash_probe = []() -> int { asm volatile("ud2"); return 3; }; #elif defined(BOTAN_TARGET_CPU_IS_ARM_FAMILY) //ARM: asm volatile (".word 0xf7f0a000\n"); // illegal instruction in both ARM and Thumb modes - crash_probe = []() { asm volatile(".word 0xe7f0def0\n"); return 3; }; + crash_probe = []() -> int { asm volatile(".word 0xe7f0def0\n"); return 3; }; #else /* PPC: "The instruction with primary opcode 0, when the instruction does not consist |