Tell people to use character literals or CHARVAL instead of strings as numbers

This commit is contained in:
Rangi42
2025-09-03 22:46:19 -04:00
parent c5c2800f17
commit c5d437ab3c
6 changed files with 13 additions and 10 deletions

View File

@@ -186,7 +186,10 @@ uint32_t act_CharToNum(std::string const &str) {
}
uint32_t act_StringToNum(std::string const &str) {
warning(WARNING_OBSOLETE, "Treating strings as numbers is deprecated");
warning(
WARNING_OBSOLETE,
"Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead"
);
if (std::vector<int32_t> units = charmap_Convert(str); units.size() == 1) {
// The string is a single character with a single unit value,
// which can be used directly as a number.

View File

@@ -1,4 +1,4 @@
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at empty-strings.asm(5)
error: Strings as numbers must be a single charmap unit
at empty-strings.asm(5)

View File

@@ -1,8 +1,8 @@
warning: All character units must be 8-bit [-Wtruncation]
at multivalue-charmap.asm(11)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at multivalue-charmap.asm(20)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at multivalue-charmap.asm(21)
warning: All character units must be 8-bit [-Wtruncation]
at multivalue-charmap.asm(22)

View File

@@ -6,7 +6,7 @@ error: syntax error, unexpected end of line
at nested-bad-interpolation.asm(1)
error: Interpolated symbol `b` is a reserved keyword; add a '#' prefix to use it as a raw symbol
at nested-bad-interpolation.asm(2)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at nested-bad-interpolation.asm(2)
error: Strings as numbers must be a single charmap unit
at nested-bad-interpolation.asm(2)
@@ -14,7 +14,7 @@ error: Interpolated symbol `c` is a reserved keyword; add a '#' prefix to use it
at nested-bad-interpolation.asm(3)
error: Interpolated symbol `` does not exist
at nested-bad-interpolation.asm(3)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at nested-bad-interpolation.asm(3)
error: Strings as numbers must be a single charmap unit
at nested-bad-interpolation.asm(3)

View File

@@ -1,4 +1,4 @@
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at raw-string-symbol-errors.asm(7)
error: Strings as numbers must be a single charmap unit
at raw-string-symbol-errors.asm(7)
@@ -10,7 +10,7 @@ error: `m` is not a string symbol
at raw-string-symbol-errors.asm(13)
error: `u` is not a string symbol
at raw-string-symbol-errors.asm(14)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at raw-string-symbol-errors.asm(17)
error: Strings as numbers must be a single charmap unit
at raw-string-symbol-errors.asm(17)

View File

@@ -1,6 +1,6 @@
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at string-concat.asm(21)
warning: Treating strings as numbers is deprecated [-Wobsolete]
warning: Treating strings as numbers is deprecated; use character literals or `CHARVAL` instead [-Wobsolete]
at string-concat.asm(21)
error: syntax error, unexpected ++
at string-concat.asm(25)