From: Henri Verbeet hverbeet@codeweavers.com
--- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac index 4cb229d5e..7fe70615f 100644 --- a/configure.ac +++ b/configure.ac @@ -59,14 +59,15 @@ AS_IF([test "x${GCC}" = "xyes"], VKD3D_CHECK_CFLAGS([-std=c99]) VKD3D_CHECK_CFLAGS([-fvisibility=hidden]) VKD3D_CHECK_CFLAGS([-Wdeclaration-after-statement]) + VKD3D_CHECK_CFLAGS([-Wempty-body]) + VKD3D_CHECK_CFLAGS([-Wenum-conversion]) VKD3D_CHECK_CFLAGS([-Wimplicit-fallthrough]) VKD3D_CHECK_CFLAGS([-Winit-self]) VKD3D_CHECK_CFLAGS([-Wmissing-prototypes]) + VKD3D_CHECK_CFLAGS([-Wpointer-arith]) VKD3D_CHECK_CFLAGS([-Wshadow]) VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter]) VKD3D_CHECK_CFLAGS([-Wvla]) - VKD3D_CHECK_CFLAGS([-Wpointer-arith]) - VKD3D_CHECK_CFLAGS([-Wenum-conversion]) VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])])
dnl Check for cross compilers
From: Henri Verbeet hverbeet@codeweavers.com
--- configure.ac | 1 + 1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac index 7fe70615f..6d352895f 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ AS_IF([test "x${GCC}" = "xyes"], VKD3D_CHECK_CFLAGS([-Wmissing-prototypes]) VKD3D_CHECK_CFLAGS([-Wpointer-arith]) VKD3D_CHECK_CFLAGS([-Wshadow]) + VKD3D_CHECK_CFLAGS([-Wshift-overflow=2]) VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter]) VKD3D_CHECK_CFLAGS([-Wvla]) VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])])
From: Henri Verbeet hverbeet@codeweavers.com
libs/vkd3d-shader/tpf.c: In function ‘write_sm4_unary_op_with_two_destinations’: libs/vkd3d-shader/tpf.c:4489:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] assert(1 - dst_idx >= 0); ^~ libs/vkd3d-shader/tpf.c: In function ‘write_sm4_binary_op_with_two_destinations’: libs/vkd3d-shader/tpf.c:4549:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] assert(1 - dst_idx >= 0); ^~ --- configure.ac | 1 + libs/vkd3d-shader/tpf.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 6d352895f..e2376b0d6 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,7 @@ AS_IF([test "x${GCC}" = "xyes"], VKD3D_CHECK_CFLAGS([-Wpointer-arith]) VKD3D_CHECK_CFLAGS([-Wshadow]) VKD3D_CHECK_CFLAGS([-Wshift-overflow=2]) + VKD3D_CHECK_CFLAGS([-Wtype-limits]) VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter]) VKD3D_CHECK_CFLAGS([-Wvla]) VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])]) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 10dde9852..c6cf1c951 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -4477,7 +4477,7 @@ static void write_sm4_unary_op(const struct tpf_writer *tpf, enum vkd3d_sm4_opco }
static void write_sm4_unary_op_with_two_destinations(const struct tpf_writer *tpf, enum vkd3d_sm4_opcode opcode, - const struct hlsl_ir_node *dst, unsigned dst_idx, const struct hlsl_ir_node *src) + const struct hlsl_ir_node *dst, unsigned int dst_idx, const struct hlsl_ir_node *src) { struct sm4_instruction instr;
@@ -4486,7 +4486,6 @@ static void write_sm4_unary_op_with_two_destinations(const struct tpf_writer *tp
assert(dst_idx < ARRAY_SIZE(instr.dsts)); sm4_dst_from_node(&instr.dsts[dst_idx], dst); - assert(1 - dst_idx >= 0); instr.dsts[1 - dst_idx].reg.type = VKD3DSPR_NULL; instr.dsts[1 - dst_idx].reg.dimension = VSIR_DIMENSION_NONE; instr.dsts[1 - dst_idx].reg.idx_count = 0; @@ -4536,7 +4535,7 @@ static void write_sm4_binary_op_dot(const struct tpf_writer *tpf, enum vkd3d_sm4 }
static void write_sm4_binary_op_with_two_destinations(const struct tpf_writer *tpf, - enum vkd3d_sm4_opcode opcode, const struct hlsl_ir_node *dst, unsigned dst_idx, + enum vkd3d_sm4_opcode opcode, const struct hlsl_ir_node *dst, unsigned int dst_idx, const struct hlsl_ir_node *src1, const struct hlsl_ir_node *src2) { struct sm4_instruction instr; @@ -4546,7 +4545,6 @@ static void write_sm4_binary_op_with_two_destinations(const struct tpf_writer *t
assert(dst_idx < ARRAY_SIZE(instr.dsts)); sm4_dst_from_node(&instr.dsts[dst_idx], dst); - assert(1 - dst_idx >= 0); instr.dsts[1 - dst_idx].reg.type = VKD3DSPR_NULL; instr.dsts[1 - dst_idx].reg.dimension = VSIR_DIMENSION_NONE; instr.dsts[1 - dst_idx].reg.idx_count = 0;
From: Henri Verbeet hverbeet@codeweavers.com
libs/vkd3d-shader/hlsl.c: In function ‘declare_predefined_types’: libs/vkd3d-shader/hlsl.c:3408:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] {"technique", 9}, ^~~~~~~~~~~ ... programs/vkd3d-compiler/main.c: In function ‘parse_formatting’: programs/vkd3d-compiler/main.c:303:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] {"colour", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR}, ^~~~~~~~ ... --- configure.ac | 1 + libs/vkd3d-shader/hlsl.c | 2 +- programs/vkd3d-compiler/main.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac index e2376b0d6..caceb4455 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,7 @@ AS_IF([test "x${GCC}" = "xyes"], VKD3D_CHECK_CFLAGS([-Wtype-limits]) VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter]) VKD3D_CHECK_CFLAGS([-Wvla]) + VKD3D_CHECK_CFLAGS([-Wwrite-strings]) VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])])
dnl Check for cross compilers diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 353e34d21..305659e7a 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -3400,7 +3400,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
static const struct { - char *name; + const char *name; unsigned int version; } technique_types[] = diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 3fa54aada..c05b774e0 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -295,7 +295,7 @@ static bool parse_formatting(uint32_t *formatting, bool *colour, char *arg) { static const struct formatting_option { - char *name; + const char *name; enum vkd3d_shader_compile_option_formatting_flags value; } opts[] =
Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/tpf.c:
assert(dst_idx < ARRAY_SIZE(instr.dsts)); sm4_dst_from_node(&instr.dsts[dst_idx], dst);
- assert(1 - dst_idx >= 0);
Well, I would have replaced this with the proper check... But ok, I think we've already discussed assertions enough.
This merge request was approved by Giovanni Mascellani.