Skip to content

Commit a6d3b49

Browse files
Eric Botcazoupmderodat
authored andcommitted
[Ada] Fix type mismatch warnings during LTO bootstrap gcc-mirror#3
gcc/ada/ * atree.h (Slots_Ptr): Change pointed-to type to any_slot. * fe.h (Get_RT_Exception_Name): Change type of parameter. * namet.ads (Name_Entry): Mark non-boolean components as aliased, reorder the boolean components and add an explicit Spare component. * namet.adb (Name_Enter): Adjust aggregate accordingly. (Name_Find): Likewise. (Reinitialize): Likewise. * namet.h (struct Name_Entry): Adjust accordingly. (Names_Ptr): Use correct type. (Name_Chars_Ptr): Likewise. (Get_Name_String): Fix declaration and adjust to above changes. * types.ads (RT_Exception_Code): Add pragma Convention C. * types.h (Column_Number_Type): Fix original type. (slot): Rename union type to... (any_slot): ...this and adjust assertion accordingly. (RT_Exception_Code): New enumeration type. * uintp.ads (Uint_Entry): Mark components as aliased. * uintp.h (Uints_Ptr): Use correct type. (Udigits_Ptr): Likewise. * gcc-interface/gigi.h (gigi): Adjust name and type of parameter. * gcc-interface/cuintp.c (UI_To_gnu): Adjust references to Uints_Ptr and Udigits_Ptr. * gcc-interface/trans.c (Slots_Ptr): Adjust pointed-to type. (gigi): Adjust type of parameter. (build_raise_check): Add cast in call to Get_RT_Exception_Name.
1 parent d6de75d commit a6d3b49

File tree

12 files changed

+189
-176
lines changed

12 files changed

+189
-176
lines changed

gcc/ada/atree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern Node_Id Current_Error_Node;
7070
these even-lower-level getters. */
7171

7272
extern Field_Offset *Node_Offsets_Ptr;
73-
extern slot *Slots_Ptr;
73+
extern any_slot *Slots_Ptr;
7474

7575
INLINE Union_Id Get_1_Bit_Field (Node_Id N, Field_Offset Offset);
7676
INLINE Union_Id Get_2_Bit_Field (Node_Id N, Field_Offset Offset);

gcc/ada/fe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extern Uint Error_Msg_Uint_2;
122122

123123
extern Entity_Id Get_Local_Raise_Call_Entity (void);
124124
extern Entity_Id Get_RT_Exception_Entity (int);
125-
extern void Get_RT_Exception_Name (int);
125+
extern void Get_RT_Exception_Name (enum RT_Exception_Code);
126126
extern void Warn_If_No_Local_Raise (int);
127127

128128
/* exp_code: */

gcc/ada/gcc-interface/cuintp.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
5050
For efficiency, this method is used only for integer values larger than the
5151
constant Uint_Bias. If a Uint is less than this constant, then it contains
52-
the integer value itself. The origin of the Uints_Ptr table is adjusted so
53-
that a Uint value of Uint_Bias indexes the first element.
52+
the integer value itself.
5453
5554
First define a utility function that is build_int_cst for integral types and
5655
does a conversion for floating-point types. */
@@ -85,9 +84,9 @@ UI_To_gnu (Uint Input, tree type)
8584
gnu_ret = build_cst_from_int (comp_type, Input - Uint_Direct_Bias);
8685
else
8786
{
88-
Int Idx = Uints_Ptr[Input].Loc;
89-
Pos Length = Uints_Ptr[Input].Length;
90-
Int First = Udigits_Ptr[Idx];
87+
Int Idx = (*Uints_Ptr)[Input - Uint_Table_Start].Loc;
88+
Pos Length = (*Uints_Ptr)[Input - Uint_Table_Start].Length;
89+
Int First = (*Udigits_Ptr)[Idx];
9190
tree gnu_base;
9291

9392
gcc_assert (Length > 0);
@@ -109,14 +108,14 @@ UI_To_gnu (Uint Input, tree type)
109108
fold_build2 (MULT_EXPR, comp_type,
110109
gnu_ret, gnu_base),
111110
build_cst_from_int (comp_type,
112-
Udigits_Ptr[Idx]));
111+
(*Udigits_Ptr)[Idx]));
113112
else
114113
for (Idx++, Length--; Length; Idx++, Length--)
115114
gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
116115
fold_build2 (MULT_EXPR, comp_type,
117116
gnu_ret, gnu_base),
118117
build_cst_from_int (comp_type,
119-
Udigits_Ptr[Idx]));
118+
(*Udigits_Ptr)[Idx]));
120119
}
121120

122121
gnu_ret = convert (type, gnu_ret);

gcc/ada/gcc-interface/gigi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ extern void gigi (Node_Id gnat_root,
235235
int max_gnat_node,
236236
int number_name,
237237
Field_Offset *node_offsets_ptr,
238-
slot *Slots,
238+
any_slot *slots_ptr,
239239
Node_Id *next_node_ptr,
240240
Node_Id *prev_node_ptr,
241241
struct Elist_Header *elists_ptr,

gcc/ada/gcc-interface/trans.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
/* Pointers to front-end tables accessed through macros. */
7878
Field_Offset *Node_Offsets_Ptr;
79-
slot *Slots_Ptr;
79+
any_slot *Slots_Ptr;
8080
Node_Id *Next_Node_Ptr;
8181
Node_Id *Prev_Node_Ptr;
8282
struct Elist_Header *Elists_Ptr;
@@ -280,7 +280,7 @@ gigi (Node_Id gnat_root,
280280
int max_gnat_node,
281281
int number_name ATTRIBUTE_UNUSED,
282282
Field_Offset *node_offsets_ptr,
283-
slot *slots_ptr,
283+
any_slot *slots_ptr,
284284
Node_Id *next_node_ptr,
285285
Node_Id *prev_node_ptr,
286286
struct Elist_Header *elists_ptr,
@@ -752,7 +752,7 @@ build_raise_check (int check, enum exception_info_kind kind)
752752

753753
strcpy (Name_Buffer, pfx);
754754
Name_Len = sizeof (pfx) - 1;
755-
Get_RT_Exception_Name (check);
755+
Get_RT_Exception_Name ((enum RT_Exception_Code) check);
756756

757757
if (kind == exception_simple)
758758
{

gcc/ada/namet.adb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,11 +1133,12 @@ package body Namet is
11331133
Name_Len => Short (Buf.Length),
11341134
Byte_Info => 0,
11351135
Int_Info => 0,
1136+
Hash_Link => No_Name,
1137+
Name_Has_No_Encodings => False,
11361138
Boolean1_Info => False,
11371139
Boolean2_Info => False,
11381140
Boolean3_Info => False,
1139-
Name_Has_No_Encodings => False,
1140-
Hash_Link => No_Name));
1141+
Spare => False));
11411142

11421143
-- Set corresponding string entry in the Name_Chars table
11431144

@@ -1239,12 +1240,13 @@ package body Namet is
12391240
((Name_Chars_Index => Name_Chars.Last,
12401241
Name_Len => Short (Buf.Length),
12411242
Hash_Link => No_Name,
1242-
Name_Has_No_Encodings => False,
12431243
Int_Info => 0,
12441244
Byte_Info => 0,
1245+
Name_Has_No_Encodings => False,
12451246
Boolean1_Info => False,
12461247
Boolean2_Info => False,
1247-
Boolean3_Info => False));
1248+
Boolean3_Info => False,
1249+
Spare => False));
12481250

12491251
-- Set corresponding string entry in the Name_Chars table
12501252

@@ -1324,11 +1326,12 @@ package body Namet is
13241326
Name_Len => 1,
13251327
Byte_Info => 0,
13261328
Int_Info => 0,
1329+
Hash_Link => No_Name,
1330+
Name_Has_No_Encodings => True,
13271331
Boolean1_Info => False,
13281332
Boolean2_Info => False,
13291333
Boolean3_Info => False,
1330-
Name_Has_No_Encodings => True,
1331-
Hash_Link => No_Name));
1334+
Spare => False));
13321335

13331336
Name_Chars.Append (C);
13341337
Name_Chars.Append (ASCII.NUL);

gcc/ada/namet.ads

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -570,33 +570,36 @@ private
570570
Table_Name => "Name_Chars");
571571

572572
type Name_Entry is record
573-
Name_Chars_Index : Int;
573+
Name_Chars_Index : aliased Int;
574574
-- Starting location of characters in the Name_Chars table minus one
575575
-- (i.e. pointer to character just before first character). The reason
576576
-- for the bias of one is that indexes in Name_Buffer are one's origin,
577577
-- so this avoids unnecessary adds and subtracts of 1.
578578

579-
Name_Len : Short;
579+
Name_Len : aliased Short;
580580
-- Length of this name in characters
581581

582-
Byte_Info : Byte;
582+
Byte_Info : aliased Byte;
583583
-- Byte value associated with this name
584584

585-
Boolean1_Info : Boolean;
586-
Boolean2_Info : Boolean;
587-
Boolean3_Info : Boolean;
588-
-- Boolean values associated with the name
589-
590585
Name_Has_No_Encodings : Boolean;
591586
-- This flag is set True if the name entry is known not to contain any
592587
-- special character encodings. This is used to speed up repeated calls
593588
-- to Append_Decoded. A value of False means that it is not known
594589
-- whether the name contains any such encodings.
595590

596-
Hash_Link : Name_Id;
591+
Boolean1_Info : Boolean;
592+
Boolean2_Info : Boolean;
593+
Boolean3_Info : Boolean;
594+
-- Boolean values associated with the name
595+
596+
Spare : Boolean;
597+
-- Four remaining bits in the current byte
598+
599+
Hash_Link : aliased Name_Id;
597600
-- Link to next entry in names table for same hash code
598601

599-
Int_Info : Int;
602+
Int_Info : aliased Int;
600603
-- Int Value associated with this name
601604

602605
end record;
@@ -605,10 +608,11 @@ private
605608
Name_Chars_Index at 0 range 0 .. 31;
606609
Name_Len at 4 range 0 .. 15;
607610
Byte_Info at 6 range 0 .. 7;
608-
Boolean1_Info at 7 range 0 .. 0;
609-
Boolean2_Info at 7 range 1 .. 1;
610-
Boolean3_Info at 7 range 2 .. 2;
611-
Name_Has_No_Encodings at 7 range 3 .. 7;
611+
Name_Has_No_Encodings at 7 range 0 .. 0;
612+
Boolean1_Info at 7 range 1 .. 1;
613+
Boolean2_Info at 7 range 2 .. 2;
614+
Boolean3_Info at 7 range 3 .. 3;
615+
Spare at 7 range 4 .. 7;
612616
Hash_Link at 8 range 0 .. 31;
613617
Int_Info at 12 range 0 .. 31;
614618
end record;

gcc/ada/namet.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,28 @@
3232
extern "C" {
3333
#endif
3434

35-
/* Structure defining a names table entry. */
36-
35+
/* Structure defining a name table entry. */
3736
struct Name_Entry
3837
{
39-
Int Name_Chars_Index; /* Starting location of char in Name_Chars table. */
40-
Short Name_Len; /* Length of this name in characters. */
41-
Byte Byte_Info; /* Byte value associated with this name */
42-
Byte Spare; /* Unused */
43-
Name_Id Hash_Link; /* Link to next entry in names table for same hash
44-
code. Not accessed by C routines. */
45-
Int Int_Info; /* Int value associated with this name */
38+
Int Name_Chars_Index;
39+
Short Name_Len;
40+
Byte Byte_Info;
41+
Byte Name_Has_No_Encodings : 1;
42+
Byte Boolean1_Info : 1;
43+
Byte Boolean2_Info : 1;
44+
Byte Boolean3_Info : 1;
45+
Byte Spare : 4;
46+
Name_Id Hash_Link;
47+
Int Int_Info;
4648
};
4749

48-
/* Pointer to names table vector. */
50+
/* Pointer to the name table. */
4951
#define Names_Ptr namet__name_entries__table
50-
extern struct Name_Entry *Names_Ptr;
52+
extern struct Name_Entry (*Names_Ptr)[];
5153

52-
/* Pointer to name characters table. */
54+
/* Pointer to the name character table. */
5355
#define Name_Chars_Ptr namet__name_chars__table
54-
extern char *Name_Chars_Ptr;
56+
extern char (*Name_Chars_Ptr)[];
5557

5658
/* This is Hostparm.Max_Line_Length. */
5759
#define Max_Line_Length (32767 - 1)
@@ -75,12 +77,13 @@ extern struct Bounded_String Global_Name_Buffer;
7577
strings we want are sitting in the name strings table in exactly the form
7678
we need them (NUL terminated), we just point to the name directly. */
7779

78-
static char *Get_Name_String (Name_Id);
80+
INLINE char *Get_Name_String (Name_Id);
7981

8082
INLINE char *
8183
Get_Name_String (Name_Id Id)
8284
{
83-
return Name_Chars_Ptr + Names_Ptr[Id - First_Name_Id].Name_Chars_Index + 1;
85+
return
86+
&(*Name_Chars_Ptr)[(*Names_Ptr)[Id - First_Name_Id].Name_Chars_Index + 1];
8487
}
8588

8689
#define Name_Equals namet__name_equals

gcc/ada/types.ads

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ package Types is
930930
SE_Object_Too_Large, -- 35
931931
PE_Stream_Operation_Not_Allowed, -- 36
932932
PE_Build_In_Place_Mismatch); -- 37
933+
pragma Convention (C, RT_Exception_Code);
933934

934935
Last_Reason_Code : constant :=
935936
RT_Exception_Code'Pos (RT_Exception_Code'Last);

0 commit comments

Comments
 (0)