aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/csets.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-01-02 00:51:21 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-04 05:17:29 -0400
commitd4b0a294694a145aa33a25d1f923f4085b8f7d99 (patch)
tree255d19fc97528d34027860dabd117c0291addec9 /gcc/ada/csets.adb
parentb65d9aff59bdaa77578de0666077fdf671a020bc (diff)
downloadgcc-d4b0a294694a145aa33a25d1f923f4085b8f7d99.zip
gcc-d4b0a294694a145aa33a25d1f923f4085b8f7d99.tar.gz
gcc-d4b0a294694a145aa33a25d1f923f4085b8f7d99.tar.bz2
[Ada] Fix inconsistent handling of character set control switches
gcc/ada/ * csets.adb (Initialize): Refactor into CASE statement; raise exception on unsupported code of character set (it will be gently rejected earlier when scanning command line switches). * switch-b.adb (Scan_Binder_Switches): Refactor into a membership expression; add missing '9' choice; reorder as described by GNAT UG, section 4.3.11. * switch-c.adb (Scan_Front_End_Switches): Refactor into a membership expression and reorder as above. * doc/gnat_ugn/building_executable_programs_with_gnat.rst (gnatic): Mention '5' as an allowed value for "c". * gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada/csets.adb')
-rw-r--r--gcc/ada/csets.adb48
1 files changed, 25 insertions, 23 deletions
diff --git a/gcc/ada/csets.adb b/gcc/ada/csets.adb
index 1961fcd..29a1592 100644
--- a/gcc/ada/csets.adb
+++ b/gcc/ada/csets.adb
@@ -1091,38 +1091,40 @@ package body Csets is
begin
-- Set Fold_Upper table from source code indication
- if Identifier_Character_Set = '1'
- or else Identifier_Character_Set = 'w'
- then
- Fold_Upper := Fold_Latin_1;
+ case Identifier_Character_Set is
+ when '1' | 'w' =>
+ Fold_Upper := Fold_Latin_1;
- elsif Identifier_Character_Set = '2' then
- Fold_Upper := Fold_Latin_2;
+ when '2' =>
+ Fold_Upper := Fold_Latin_2;
- elsif Identifier_Character_Set = '3' then
- Fold_Upper := Fold_Latin_3;
+ when '3' =>
+ Fold_Upper := Fold_Latin_3;
- elsif Identifier_Character_Set = '4' then
- Fold_Upper := Fold_Latin_4;
+ when '4' =>
+ Fold_Upper := Fold_Latin_4;
- elsif Identifier_Character_Set = '5' then
- Fold_Upper := Fold_Cyrillic;
+ when '5' =>
+ Fold_Upper := Fold_Cyrillic;
- elsif Identifier_Character_Set = 'p' then
- Fold_Upper := Fold_IBM_PC_437;
+ when '9' =>
+ Fold_Upper := Fold_Latin_9;
- elsif Identifier_Character_Set = '8' then
- Fold_Upper := Fold_IBM_PC_850;
+ when 'p' =>
+ Fold_Upper := Fold_IBM_PC_437;
- elsif Identifier_Character_Set = '9' then
- Fold_Upper := Fold_Latin_9;
+ when '8' =>
+ Fold_Upper := Fold_IBM_PC_850;
- elsif Identifier_Character_Set = 'f' then
- Fold_Upper := Fold_Full_Upper_Half;
+ when 'f' =>
+ Fold_Upper := Fold_Full_Upper_Half;
- else -- Identifier_Character_Set = 'n'
- Fold_Upper := Fold_No_Upper_Half;
- end if;
+ when 'n' =>
+ Fold_Upper := Fold_No_Upper_Half;
+
+ when others =>
+ raise Program_Error;
+ end case;
-- Use Fold_Upper table to compute Fold_Lower table