#1489

Add GpuContextNone = 0 for static-analysis compatibility

Openalasramopened 15d ago

Our integration enables clang-analyzer-optin.core.EnumCastOutOfRange, which reports the zero-valued GPU context flags used by Tracy. We carry a one-line downstream patch adding GpuContextNone = 0.

In Tracy 0.14.1 and upstream revision fd23005a67e25f53dd420df6350a2f5907afedc3, GpuContextFlags declares only GpuContextCalibration = 1 << 0. GPU backends nevertheless intentionally use GpuContextFlags(0) for contexts without calibration, including OpenGL when automatic calibration is disabled.

Reproduction

Enable clang-analyzer-optin.core.EnumCastOutOfRange in a Tracy GPU integration and analyze a context-creation path that emits GpuContextFlags(0). Our integration reports this cast; diagnostic behavior may depend on the analyzer version and configuration.

Expected behavior and proposed fix

Represent the intended empty flag set explicitly:

enum GpuContextFlags : uint8_t
{
    GpuContextNone          = 0,
    GpuContextCalibration   = 1 << 0
};

Existing zero casts can optionally use the named value. This preserves numeric values, enum storage, and the wire layout. This is a static-analysis compatibility improvement, not a demonstrated runtime failure or a claim that zero is invalid for this fixed-underlying-type enum.

Activity

0

No activity yet.