wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
10.21k stars 684 forks source link

g++-12 warnings in **release** builds #869

Open Mrkol opened 2 months ago

Mrkol commented 2 months ago

When doing a release build, g++-12.3.0 (and g++-13.2.0 too) emits a warning inside of Tracy's sources:

In file included from .../public/TracyClient.cpp:25:
.../public/client/TracySysPower.cpp: In member function ‘void tracy::SysPower::ScanDirectory(const char*, int)’:
.../public/client/TracySysPower.cpp:88:27: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   88 |                     fscanf( f, "%" PRIu64, &maxRange );
      |                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

And as far as I can tell, that entire neighborhood of code completely ignores error code return values, which isn't great, generally speaking, so I think this can and should be fixed.

Furthermore, a (seemingly false-positive) warning gets emitted in Tracy's headers, which for some reason I cannot suppress even with system includes:

In member function ‘uint8_t tracy::VkCtx::GetId() const’,
    inlined from ‘tracy::VkCtxScope::~VkCtxScope()’ at .../public/tracy/TracyVulkan.hpp:620:58,
    inlined from ‘void Renderer::drawFrame()’ at /home/runner/work/graphics-course/graphics-course/tasks/model_bakery/renderer/Renderer.cpp:130:5:
.../public/tracy/TracyVulkan.hpp:341:16: error: ‘___tracy_gpu_zone.tracy::VkCtxScope::m_ctx’ may be used uninitialized [-Werror=maybe-uninitialized]
  341 |         return m_context;
      |                ^~~~~~~~~

I'm not too sure about this one, maybe it should simply be suppressed via gcc-specific pragmas?

And yeah I have no idea why this only happens in release builds.