public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6237] [Ada] Simplify handling of user-defined numeric literals
@ 2022-01-05 11:34 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-05 11:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7c58372ad22f94d21b15ae2f2838e761b36b3486
commit r12-6237-g7c58372ad22f94d21b15ae2f2838e761b36b3486
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Wed Dec 1 15:53:45 2021 +0100
[Ada] Simplify handling of user-defined numeric literals
gcc/ada/
* sem_util.adb (String_From_Numeric_Literal): Simplify using
membership tests and ranges; fix whitespace.
Diff:
---
gcc/ada/sem_util.adb | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 7064dfac8d8..bfe15fa96f6 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -28978,7 +28978,7 @@ package body Sem_Util is
Source_Text (Get_Source_File_Index (Loc));
Src_Ptr : Source_Ptr := Loc;
- C : Character := Sbuffer (Src_Ptr);
+ C : Character := Sbuffer (Src_Ptr);
-- Current source program character
function Belongs_To_Numeric_Literal (C : Character) return Boolean;
@@ -28991,9 +28991,7 @@ package body Sem_Util is
function Belongs_To_Numeric_Literal (C : Character) return Boolean is
begin
case C is
- when '0' .. '9'
- | '_' | '.' | 'e' | '#' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
- =>
+ when '0' .. '9' | '_' | '.' | 'e' | '#' | 'A' .. 'F' =>
return True;
-- Make sure '+' or '-' is part of an exponent
@@ -29002,7 +29000,7 @@ package body Sem_Util is
declare
Prev_C : constant Character := Sbuffer (Src_Ptr - 1);
begin
- return Prev_C = 'e' or else Prev_C = 'E';
+ return Prev_C in 'e' | 'E';
end;
-- Other characters cannot belong to a numeric literal
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-05 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 11:34 [gcc r12-6237] [Ada] Simplify handling of user-defined numeric literals Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).