node-dot-cpp / alloc-test

Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical
BSD 3-Clause "New" or "Revised" License
43 stars 12 forks source link

compiler support? #4

Open WallStProg opened 5 years ago

WallStProg commented 5 years ago

Curious what compilers you're using. I'm trying to build on CentOS 7 with gcc 5.3.0 and clang 8.0.0 and both give (different) compile errors.

gcc

In file included from ../src/allocator_tester.h:54:0,
                 from ../src/allocator_tester.cpp:35:
../src/void_allocator.h: In member function \u2018void* VoidAllocatorForTest<ActualAllocator>::allocateSlots(size_t)\u2019:
../src/void_allocator.h:60:60: error: expected \u2018,\u2019 before \u2018)\u2019 token
  void* allocateSlots( size_t sz ) { static_assert( isFake()); assert( sz <= fakeBufferSize ); return alloc.allocate( sz ); }
                                                            ^
../src/void_allocator.h:60:60: error: expected string-literal before \u2018)\u2019 token
In file included from ../src/allocator_tester.cpp:35:0:
../src/allocator_tester.h: In function \u2018void randomPos_RandomSize(AllocatorUnderTest&, size_t, size_t, size_t, size_t, size_t)\u2019:
../src/allocator_tester.h:285:5: error: expected \u2018(\u2019 before \u2018constexpr\u2019
  if constexpr ( !allocatorUnderTest.isFake() )
     ^
../src/allocator_tester.h:287:2: error: \u2018else\u2019 without a previous \u2018if\u2019
  else
  ^
../src/allocator_tester.h:306:8: error: expected \u2018(\u2019 before \u2018constexpr\u2019
     if constexpr ( doMemAccess )
        ^
../src/allocator_tester.cpp:185:1: error: expected \u2018}\u2019 at end of input
 }
 ^
../src/allocator_tester.cpp:185:1: error: expected \u2018}\u2019 at end of input
../src/allocator_tester.cpp:185:1: error: expected \u2018}\u2019 at end of input

clang

btorpey@bt-brix build]$ ./build_gcc.sh
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:46:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<NewDeleteAllocatorForTest, none>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::none>( allocator, testParams->startupParams.iterCount, test...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization 'runRandomTest<NewDeleteAllocatorForTest>'
      requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:135:3: note: in instantiation of function template specialization 'runTest<NewDeleteAllocatorForTest>'
      requested here
                runTest<MyAllocatorT>( &params );
                ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:49:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<NewDeleteAllocatorForTest, full>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::full>( allocator, testParams->startupParams.iterCount, test...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization 'runRandomTest<NewDeleteAllocatorForTest>'
      requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:135:3: note: in instantiation of function template specialization 'runTest<NewDeleteAllocatorForTest>'
      requested here
                runTest<MyAllocatorT>( &params );
                ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:52:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<NewDeleteAllocatorForTest, single>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::single>( allocator, testParams->startupParams.iterCount, te...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization 'runRandomTest<NewDeleteAllocatorForTest>'
      requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:135:3: note: in instantiation of function template specialization 'runTest<NewDeleteAllocatorForTest>'
      requested here
                runTest<MyAllocatorT>( &params );
                ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:55:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<NewDeleteAllocatorForTest, check>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::check>( allocator, testParams->startupParams.iterCount, tes...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization 'runRandomTest<NewDeleteAllocatorForTest>'
      requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:135:3: note: in instantiation of function template specialization 'runTest<NewDeleteAllocatorForTest>'
      requested here
                runTest<MyAllocatorT>( &params );
                ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:46:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<VoidAllocatorForTest<NewDeleteAllocatorForTest>, none>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::none>( allocator, testParams->startupParams.iterCount, test...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization
      'runRandomTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:141:4: note: in instantiation of function template specialization
      'runTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                        runTest<VoidAllocatorForTest<MyAllocatorT>>( &params );
                        ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:49:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<VoidAllocatorForTest<NewDeleteAllocatorForTest>, full>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::full>( allocator, testParams->startupParams.iterCount, test...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization
      'runRandomTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:141:4: note: in instantiation of function template specialization
      'runTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                        runTest<VoidAllocatorForTest<MyAllocatorT>>( &params );
                        ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:52:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<VoidAllocatorForTest<NewDeleteAllocatorForTest>, single>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::single>( allocator, testParams->startupParams.iterCount, te...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization
      'runRandomTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:141:4: note: in instantiation of function template specialization
      'runTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                        runTest<VoidAllocatorForTest<MyAllocatorT>>( &params );
                        ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:257:258: warning: format specifies type 'unsigned long long' but the argument has type 'size_t'
      (aka 'unsigned long') [-Wformat]
  ...[rnd_seed = %llu] ...\n", threadID, allocatorUnderTest.name(), maxItemSizeExp, maxItems, iterCount, memAccessTypeStr, rnd_seed );
                 ~~~~                                                                                                      ^~~~~~~~
                 %zu
../src/allocator_tester.cpp:55:4: note: in instantiation of function template specialization
      'randomPos_RandomSize<VoidAllocatorForTest<NewDeleteAllocatorForTest>, check>' requested here
                        randomPos_RandomSize<Allocator,MEM_ACCESS_TYPE::check>( allocator, testParams->startupParams.iterCount, tes...
                        ^
../src/allocator_tester.cpp:83:19: note: in instantiation of function template specialization
      'runRandomTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                std::thread t1( runRandomTest<Allocator>, (void*)(testParams + i) );
                                ^
../src/allocator_tester.cpp:141:4: note: in instantiation of function template specialization
      'runTest<VoidAllocatorForTest<NewDeleteAllocatorForTest> >' requested here
                        runTest<VoidAllocatorForTest<MyAllocatorT>>( &params );
                        ^
In file included from ../src/allocator_tester.cpp:35:
../src/allocator_tester.h:285:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
../src/allocator_tester.h:434:18: error: constexpr if condition is not a constant expression
        if constexpr ( !allocatorUnderTest.isFake() )
                        ^
8 warnings and 16 errors generated.
divanchykhin commented 5 years ago

Dependent on issue #5

WallStProg commented 5 years ago

Not sure what this has to do with cmake -- in any event, I did change the build script slightly to omit jemalloc and to make the compiler configurable:

${CXX} ../src/test_common.cpp ../src/allocator_tester.cpp -std=c++17 -g -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-empty-body -DNDEBUG -O2 -flto -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -lpthread -o tester_standart.bin