Enable strict C++ compiler warnings with -Werror by maxwbuckley · Pull Request #4726 · NVIDIA/TensorRT

Enable -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor
-Woverloaded-virtual -Wconversion -Wdouble-promotion -Wformat=2
-Wimplicit-fallthrough -Werror for GCC/Clang, and /W4 /WX for MSVC.

Fix all ~5,500 warnings across 114 files:
- Comment out unused parameters in plugin interface implementations
- Add static_cast for narrowing conversions (int64_t/size_t to int32_t)
- Rename constructor params to avoid shadowing member variables
- Add using declarations in plugin classes to prevent hiding base
  class virtual methods (IPluginV2DynamicExt/IPluginV2IOExt)
- Change sealed base class methods from private to protected to
  support using declarations in derived classes
- Add virtual destructor to TimerBase
- Add [[noreturn]] to reportAssertion to fix implicit-fallthrough
- Add #pragma GCC system_header to third-party half.h headers
- Add #undef before macro redefinitions across plugin headers
- Use f suffix on float literals to prevent double promotion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Max Buckley <maxwbuckley@gmail.com>
- Add Clang-specific suppression for -Wvariadic-macro-arguments-omitted
  (triggered by CUDA toolkit headers) and -Wsign-conversion (not part
  of GCC's -Wconversion)
- Fix deprecated literal operator syntax (remove space before _GiB etc.)
- Fix Clang -Wdouble-promotion: use lroundf() instead of lround() for
  float args, explicit casts for long double expressions
- Fix Clang -Wfloat-conversion: use explicit != 0.0F instead of
  implicit float-to-bool
- Fix Clang -Wsign-conversion: add static_cast<size_t>() for int-to-
  size_t conversions in sample code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Max Buckley <maxwbuckley@gmail.com>
Fix warnings in 10 sample files that are only compiled when the real
TensorRT runtime libraries are available (not with stub libs):
- BatchStream.h: add virtual destructor, int64_t narrowing casts
- sampleCharRNN: shadow fix, size_t casts
- sampleDynamicReshape: unused param, double-promotion, conversion
- sampleINT8API: shadow fix, float/int casts
- sampleIOFormats: shadow fixes, unused params, sizeof casts
- sampleNamedDimensions: unused params, float literal fixes
- sampleNonZeroPlugin: unused params, int64_t/size_t casts
- sampleOnnxMNIST: unused param, exp() float cast
- sampleOnnxMnistCoordConvAC: float literal fixes, exp() cast
- sampleProgressMonitor: int-to-float cast, exp() cast, ptr diff cast

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Max Buckley <maxwbuckley@gmail.com>