Skip to content

nir/shader_from_string: Fix -Wformat-overflow in error case

Daniel Stone requested to merge nir-shader-string-wformat-overflow into msclc-d3d12

The parser uses strstr to look for following tokens, and in case an expected token is not found, throws an error message giving the offending section.

Unfortunately it tried to print the message with the result of the advanced strstr - which would have advanced to NULL on error as the token was not found.

Use a temporary variable for the strstr result, so we can still print the offending section in error cases, only assigning it back when strstr succeeds. This fixes a GCC -Wformat-overflow warning.

Signed-off-by: Daniel Stone daniels@collabora.com

Merge request reports