google / benchmark

A microbenchmark support library
Apache License 2.0
9.03k stars 1.63k forks source link

[BUG] Warnings #1838

Open 1vanK opened 2 months ago

1vanK commented 2 months ago
Severity    Code    Description Project File    Line    Suppression State   Details
Warning C26495  Variable 'benchmark::BenchmarkReporter::Run::family_index' is uninitialized. Always initialize a member variable (type.6).  benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1846        
Warning C26495  Variable 'benchmark::BenchmarkReporter::Run::per_family_instance_index' is uninitialized. Always initialize a member variable (type.6). benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1846        
Warning C26495  Variable 'benchmark::BenchmarkReporter::Run::repetition_index' is uninitialized. Always initialize a member variable (type.6).  benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1846        
Warning C26495  Variable 'benchmark::BenchmarkReporter::Run::repetitions' is uninitialized. Always initialize a member variable (type.6).   benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1846        
Warning C26495  Variable 'benchmark::BenchmarkReporter::Run::statistics' is uninitialized. Always initialize a member variable (type.6).    benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1846        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4459   declaration of 'profiler_manager' hides global declaration  benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\src\benchmark_runner.cc    129     
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        
Warning C4324   'benchmark::State': structure was padded due to alignment specifier benchmark   F:\my_games\dviglo2d_utils\format_benchmarks\repo\third_party\benchmark\repo\include\benchmark\benchmark.h  1065        

Windows 10, Visual Studio 2022 (version 17.10.4)

изображение

imrichardcole commented 2 months ago

I think a few of these are now fixed as mentioned above, but I'll take a look to see if any remain @1vanK could you please share your cmake build commands?

Thanks

Rich.

LebedevRI commented 2 months ago

As noted in #1839, the rest of the warnings are from MSVC static analyzer. I'm not sure we should enable it globally in cmakefiles, but perhaps there is some diagnostics flag for gcc/clang that catches those, and if so, we should enable it.

1vanK commented 2 months ago

share your cmake build commands

https://github.com/dviglo2d/format_benchmarks/blob/main/third_party/benchmark/CMakeLists.txt#L4-L5

imrichardcole commented 1 month ago

As noted in #1839, the rest of the warnings are from MSVC static analyzer. I'm not sure we should enable it globally in cmakefiles, but perhaps there is some diagnostics flag for gcc/clang that catches those, and if so, we should enable it.

@LebedevRI to understand your comment, do we want to enable/fix these for MSVC?

LebedevRI commented 1 month ago

No idea about MSVC, but perhaps these same issues can be exposed by some gcc/clang warning flag, and if so, perhaps that flag should be enabled.