这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@KungFuJesus
Copy link
Contributor

The benchmarks fail to compile properly when built with ZLIB_COMPAT. The name of the class cannot have the same name as the function.

Without this, the compiler thinks we're trying to invoke the class's constructor:

/home/adam/scratch/zlib-ng/test/benchmarks/benchmark_compress.cc: In member function ‘void compress::Bench(benchmark::State&)’:
/home/adam/scratch/zlib-ng/test/benchmarks/benchmark_compress.cc:49:84: error: invalid cast to abstract class type ‘compress’
   49 |             err = PREFIX(compress)(outbuff, &maxlen, inbuff, (size_t)state.range(0));
      |                                                                                    ^
/home/adam/scratch/zlib-ng/test/benchmarks/benchmark_compress.cc:22:7: note:   because the following virtual functions are pure within ‘compress’:
   22 | class compress: public benchmark::Fixture {
      |       ^~~~~~~~
In file included from /home/adam/scratch/zlib-ng/test/benchmarks/benchmark_compress.cc:8:
  /* benchmark_compress.cc -- benchmark compress()
/usr/include/benchmark/benchmark.h:1436:16: note:     ‘virtual void benchmark::Fixture::BenchmarkCase(benchmark::State&)’
 1436 |   virtual void BenchmarkCase(State&) = 0;
      |                ^~~~~~~~~~~~~
make[2]: *** [test/benchmarks/CMakeFiles/benchmark_zlib.dir/build.make:132: test/benchmarks/CMakeFiles/benchmark_zlib.dir/benchmark_compress.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:425: test/benchmarks/CMakeFiles/benchmark_zlib.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

The benchmarks fail to compile properly when built with ZLIB_COMPAT.
The name of the class cannot have the same name as the function.
Copy link
Member

@Dead2 Dead2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@Dead2 Dead2 merged commit 80c541b into zlib-ng:develop May 19, 2024
This was referenced May 30, 2024
@Dead2 Dead2 mentioned this pull request Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants