[7/7] gdb: make COMPLETE_CHAR a constexpr

Message ID 20261001203105.1379971-8-simon.marchi@efficios.com
State New
Headers
Series Leftovers from parsers cleanup |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Simon Marchi Oct. 1, 2026, 8:30 p.m. UTC
  In ada-exp-parser.h, make COMPLETE_CHAR a constexpr rather than a
macro.

While at it, fix the comment in ada-lex.l that refers to it.  It used
the wrong name (COMPLETION_CHAR), and the constant is no longer
"below", it is now in ada-exp-parser.h.  The explanation it points to
is now the comment on ada_parse_state::returned_complete.

Change-Id: I4ecfec782add66ab658bcb1494b1f78cdd432218
---
 gdb/ada-exp-parser.h | 2 +-
 gdb/ada-lex.l        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gdb/ada-exp-parser.h b/gdb/ada-exp-parser.h
index 0f438647437e..09a716e6636c 100644
--- a/gdb/ada-exp-parser.h
+++ b/gdb/ada-exp-parser.h
@@ -24,7 +24,7 @@ 
 #include "parser-defs.h"
 
 /* The character we use to represent the completion point.  */
-#define COMPLETE_CHAR '\001'
+constexpr char COMPLETE_CHAR = '\001';
 
 namespace ada_exp_parser
 {
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 62edcd251966..857176c4d83d 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -39,8 +39,8 @@  OPER    ([-+*/=<>&]|"<="|">="|"**"|"/="|"and"|"or"|"xor"|"not"|"mod"|"rem"|"abs"
 EXP	(e[+-]{NUM10})
 POSEXP  (e"+"?{NUM10})
 
-/* This must agree with COMPLETION_CHAR below.  See the comment there
-   for the explanation.  */
+/* This must agree with COMPLETE_CHAR in ada-exp-parser.h.  See the
+   comment on ada_parse_state::returned_complete for the explanation.  */
 COMPLETE "\001"
 NOT_COMPLETE [^\001]