From 64bcef99bd49c11172db235f05f761a91b44a894 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 13 Oct 2025 11:48:33 -0400 Subject: [PATCH] Lower default `-Wtrunction=` level to 1 --- man/rgbasm.1 | 4 ++-- man/rgblink.1 | 4 ++-- src/asm/warning.cpp | 2 +- src/link/warning.cpp | 2 +- test/asm/warn-truncation.asm | 2 +- test/asm/warn-truncation.err | 8 -------- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/man/rgbasm.1 b/man/rgbasm.1 index 5f05bdda..8cd68e26 100644 --- a/man/rgbasm.1 +++ b/man/rgbasm.1 @@ -460,10 +460,10 @@ or .Fl Wno-truncation disables this warning. .Fl Wtruncation=1 -warns when an N-bit value is 2**N or greater, or less than -2**N. -.Fl Wtruncation=2 or just .Fl Wtruncation +warns when an N-bit value is 2**N or greater, or less than -2**N. +.Fl Wtruncation=2 also warns when an N-bit value is less than -2**(N-1), which will not fit in two's complement encoding. .It Fl Wunmapped-char= Warn when a character goes through charmap conversion but has no defined mapping. diff --git a/man/rgblink.1 b/man/rgblink.1 index 544da45f..cf26ba81 100644 --- a/man/rgblink.1 +++ b/man/rgblink.1 @@ -327,10 +327,10 @@ or .Fl Wno-truncation disables this warning. .Fl Wtruncation=1 -warns when an N-bit value is 2**N or greater, or less than -2**N. -.Fl Wtruncation=2 or just .Fl Wtruncation +warns when an N-bit value is 2**N or greater, or less than -2**N. +.Fl Wtruncation=2 also warns when an N-bit value is less than -2**(N-1), which will not fit in two's complement encoding. .El .Sh EXAMPLES diff --git a/src/asm/warning.cpp b/src/asm/warning.cpp index 91ba5f62..1a087c32 100644 --- a/src/asm/warning.cpp +++ b/src/asm/warning.cpp @@ -53,7 +53,7 @@ Diagnostics warnings = { .paramWarnings = { {WARNING_NUMERIC_STRING_1, WARNING_NUMERIC_STRING_2, 1}, {WARNING_PURGE_1, WARNING_PURGE_2, 2}, - {WARNING_TRUNCATION_1, WARNING_TRUNCATION_2, 2}, + {WARNING_TRUNCATION_1, WARNING_TRUNCATION_2, 1}, {WARNING_UNMAPPED_CHAR_1, WARNING_UNMAPPED_CHAR_2, 1}, }, .state = DiagnosticsState(), diff --git a/src/link/warning.cpp b/src/link/warning.cpp index d42e5d09..48cdb795 100644 --- a/src/link/warning.cpp +++ b/src/link/warning.cpp @@ -31,7 +31,7 @@ Diagnostics warnings = { {"truncation", LEVEL_EVERYTHING}, }, .paramWarnings = { - {WARNING_TRUNCATION_1, WARNING_TRUNCATION_2, 2}, + {WARNING_TRUNCATION_1, WARNING_TRUNCATION_2, 1}, }, .state = DiagnosticsState(), .nbErrors = 0, diff --git a/test/asm/warn-truncation.asm b/test/asm/warn-truncation.asm index 3850f64f..885319ef 100644 --- a/test/asm/warn-truncation.asm +++ b/test/asm/warn-truncation.asm @@ -32,7 +32,7 @@ MACRO try ENDM try Wno-truncation - try Wtruncation + try Wtruncation ; defaults to 1 try Wtruncation=0 try Wtruncation=1 try Wtruncation=2 diff --git a/test/asm/warn-truncation.err b/test/asm/warn-truncation.err index 97e50103..faf30a1d 100644 --- a/test/asm/warn-truncation.err +++ b/test/asm/warn-truncation.err @@ -6,14 +6,6 @@ warning: Expression must be 16-bit [-Wtruncation] at warn-truncation.asm::try(25) <- warn-truncation.asm(35) warning: Expression must be 16-bit [-Wtruncation] at warn-truncation.asm::try(26) <- warn-truncation.asm(35) -warning: Expression must be 8-bit; use `LOW()` to force 8-bit [-Wtruncation] - at warn-truncation.asm::try(28) <- warn-truncation.asm(35) -warning: Expression must be 16-bit [-Wtruncation] - at warn-truncation.asm::try(29) <- warn-truncation.asm(35) -warning: Expression must be 8-bit; use `LOW()` to force 8-bit [-Wtruncation] - at warn-truncation.asm::try(30) <- warn-truncation.asm(35) -warning: Expression must be 16-bit [-Wtruncation] - at warn-truncation.asm::try(31) <- warn-truncation.asm(35) warning: Expression must be 8-bit; use `LOW()` to force 8-bit [-Wtruncation] at warn-truncation.asm::try(23) <- warn-truncation.asm(37) warning: Expression must be 8-bit; use `LOW()` to force 8-bit [-Wtruncation]