QShaderBaker: fix UB (ODR violation)


The qshaderbaker.cpp TU defined an inline qHash() function for the
type QShaderBaker::GeneratedShader.

This type is a std::pair of an enum and a QShaderVersion, both of
which are q-hashable. Therefore the pair is q-hashable using the
generic qHash(std::pair) from qhashfunctions.h.

This means that qHash(QShaderBaker::GeneratedShader) works from
outside the library, but produces different results from the qHash()
function used inside the library. This is an ODR violation, which is
UB.

Well, almost. QShaderVersion is hashable only on INTEGRITY, so the ODR
violation only exists on INTEGRITY, too. But there, it's
esp. problematic, because apps are likely to be linked statically,
making the ODR violation visible to the linker.

Fix by removing the private implementation and relying on the generic
one, for INTEGRITY.

A full fix would require QShaderVersion being made hashable on all
platforms and removing the private hash function for all
platforms. This isn't pickable to older branches, though, so do that
in a follow-up.

Amends 87082753b55c9b2128d578d0b1e529e06186522e (6.0).

Pick-to: 6.11 6.8 6.5
Task-number: QTBUG-145988
Task-number: QTBUG-145990
Change-Id: I55f002704a6d1d3f04344b767b595865d8cdde68
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
commit106d7d41ce733473cd3b61ffa11190e41f7734ad
parent2a85537273f77745fa254665b19222e6cc40fdf1
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeThu, 23 Apr 2026 16:08:03 +0000