[COMMITTED] algol68: move implementation of "max abs char" to a68-low-chars.cc
Jose E. Marchesi
jemarch@gnu.org
Sat Apr 5 22:04:35 GMT 2025
---
gcc/algol68/a68-low-chars.cc | 8 ++++++++
gcc/algol68/a68-low-prelude.cc | 6 +++---
gcc/algol68/a68.h | 1 +
gcc/testsuite/algol68/execute/environment-enquiries-5.a68 | 2 +-
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gcc/algol68/a68-low-chars.cc b/gcc/algol68/a68-low-chars.cc
index 0e35f241a1d..e1d57777e7d 100644
--- a/gcc/algol68/a68-low-chars.cc
+++ b/gcc/algol68/a68-low-chars.cc
@@ -42,6 +42,14 @@
#include "a68.h"
+/* Return the maximum valid character code that can be stored in a CHAR. */
+tree
+a68_char_max (void)
+{
+ /* 0x10FFFF is the maximum valid code point in Unicode. */
+ return build_int_cst (a68_char_type, 0x10FFFF);
+}
+
/* Given an integral value, if it denotes a char code build the corresponding
CHAR. Otherwise raise a run-time error. */
diff --git a/gcc/algol68/a68-low-prelude.cc b/gcc/algol68/a68-low-prelude.cc
index aef84f617ef..22f4cc96a0f 100644
--- a/gcc/algol68/a68-low-prelude.cc
+++ b/gcc/algol68/a68-low-prelude.cc
@@ -1338,10 +1338,10 @@ a68_lower_minusinfinity (NODE_T *p, LOW_CTX_T ctx ATTRIBUTE_UNUSED)
}
tree
-a68_lower_maxabschar (NODE_T *p, LOW_CTX_T ctx ATTRIBUTE_UNUSED)
+a68_lower_maxabschar (NODE_T *p ATTRIBUTE_UNUSED,
+ LOW_CTX_T ctx ATTRIBUTE_UNUSED)
{
- /* 0x10FFFF is the maximum valid code point in Unicode. */
- return build_int_cst (CTYPE (MOID (p)), 0x10FFFF);
+ return a68_char_max ();
}
tree
diff --git a/gcc/algol68/a68.h b/gcc/algol68/a68.h
index 17764ef284f..eae4809053d 100644
--- a/gcc/algol68/a68.h
+++ b/gcc/algol68/a68.h
@@ -590,6 +590,7 @@ char *a68_string_process_breaks (const char *str);
/* a68-low-chars.cc */
+tree a68_char_max (void);
tree a68_char_repr (NODE_T *p, tree val);
tree a68_char_abs (tree val);
diff --git a/gcc/testsuite/algol68/execute/environment-enquiries-5.a68 b/gcc/testsuite/algol68/execute/environment-enquiries-5.a68
index 63ba40dc5ec..63b51d027c8 100644
--- a/gcc/testsuite/algol68/execute/environment-enquiries-5.a68
+++ b/gcc/testsuite/algol68/execute/environment-enquiries-5.a68
@@ -1,4 +1,4 @@
# Environment enquiries for certain particular characters. #
BEGIN ASSERT (null character /= blank);
- ASSERT (max abs char > 0)
+ ASSERT (max abs char = ABS 16r10ffff)
END
--
2.30.2
More information about the Algol68
mailing list