tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Inconsistent semicolon use in GPU macros

Open JuanDiegoMontoya opened this issue 2 years ago • 1 comments

In TracyOpenGL.hpp, there are several macros that have a semicolon at the end, contrary to other macros in the API. This inconsistency causes some minor issues:

  • Manually adding the semicolon after using the macro causes some linters to complain about a statement that has no effect
  • Omitting the semicolon after the macro creates an (seemingly) inconsistent style, and causes some IDEs to add an extra indentation to the next line

The following macros are affected:

  • TracyGpuNamedZone
  • TracyGpuNamedZoneC
  • TracyGpuZoneTransient
  • TracyGpuCollect
  • TracyGpuNamedZoneS
  • TracyGpuNamedZoneCS
  • TracyGpuZoneTransientS

Additionally, if TRACY_HAS_CALLSTACK is not defined, the latter four macros will not have an implicit semicolon at the end, leading to further inconsistent behavior (for example, the application not compiling if the user relied on the semicolon that was previously there).

At a glance, the issue appears to affect all of the other GPU headers (TracyVulkan.hpp, TracyD3D11.hpp, TracyD3D12.hpp, and TracyOpenCL.hpp).

JuanDiegoMontoya avatar Aug 09 '23 07:08 JuanDiegoMontoya

I also think this would be nice to fix, but might be a breaking change so it needs to be planned for? There are similar inconsistencies inside TracyD3D12.hpp (TracyD3D12NamedZone for example)

Lectem avatar Jul 04 '25 10:07 Lectem