[gcc r12-6251] [Ada] Simplify detection of alphabetic characters with membership test

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Wed Jan 5 11:35:39 GMT 2022


https://gcc.gnu.org/g:a7b4fbd9b4c2c24bac956125068d2540976bf90e

commit r12-6251-ga7b4fbd9b4c2c24bac956125068d2540976bf90e
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Dec 2 15:44:57 2021 +0100

    [Ada] Simplify detection of alphabetic characters with membership test
    
    gcc/ada/
    
            * sem_prag.adb (Adjust_External_Name_Case): Use membership test.

Diff:
---
 gcc/ada/sem_prag.adb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 40c4db40abd..ce2b2ef1962 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -398,14 +398,12 @@ package body Sem_Prag is
             CC := Get_String_Char (Strval (N), J);
 
             if Opt.External_Name_Exp_Casing = Uppercase
-              and then CC >= Get_Char_Code ('a')
-              and then CC <= Get_Char_Code ('z')
+              and then CC in Get_Char_Code ('a') .. Get_Char_Code ('z')
             then
                Store_String_Char (CC - 32);
 
             elsif Opt.External_Name_Exp_Casing = Lowercase
-              and then CC >= Get_Char_Code ('A')
-              and then CC <= Get_Char_Code ('Z')
+              and then CC in Get_Char_Code ('A') .. Get_Char_Code ('Z')
             then
                Store_String_Char (CC + 32);


More information about the Gcc-cvs mailing list