Skip to content

Commit

Permalink
Suppress warnings about inevitable unreachable code
Browse files Browse the repository at this point in the history
Ref. #1131
treiher committed Aug 23, 2022
1 parent de7d680 commit 95ec24e
Showing 26 changed files with 132 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rflx/generator/session.py
Original file line number Diff line number Diff line change
@@ -1629,7 +1629,21 @@ def _create_read_procedure(
(
Variable("others"),
[
PragmaStatement(
"Warnings",
[
Variable("Off"),
String("unreachable code"),
],
),
NullStatement(),
PragmaStatement(
"Warnings",
[
Variable("On"),
String("unreachable code"),
],
),
],
),
],
@@ -1836,7 +1850,21 @@ def _create_write_procedure(
(
Variable("others"),
[
PragmaStatement(
"Warnings",
[
Variable("Off"),
String("unreachable code"),
],
),
NullStatement(),
PragmaStatement(
"Warnings",
[
Variable("On"),
String("unreachable code"),
],
),
],
),
],
Original file line number Diff line number Diff line change
@@ -234,7 +234,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.M_S_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -267,7 +269,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.M_R_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -232,7 +232,9 @@ is
when S_Reply =>
Test_Message_Read (Ctx.P.M_S_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -265,7 +267,9 @@ is
when S_Start =>
Test_Message_Write (Ctx.P.M_R_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -421,7 +421,9 @@ is
when S_Reply =>
Test_Message_Read (Ctx.P.M_S_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -454,7 +456,9 @@ is
when S_Receive =>
Test_Message_Write (Ctx.P.M_R_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -278,7 +278,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
Original file line number Diff line number Diff line change
@@ -208,7 +208,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -241,7 +243,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -201,7 +201,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -234,7 +236,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -189,7 +189,9 @@ is
when S_Reply =>
Test_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -222,7 +224,9 @@ is
when S_Start =>
Test_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -183,15 +183,19 @@ is
Buffer := (others => 0);
case Chan is
when C_I_1 | C_I_2 =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
when C_O =>
case Ctx.P.Next_State is
when S_Reply_1 =>
Universal_Message_Read (Ctx.P.Message_1_Ctx);
when S_Reply_2 =>
Universal_Message_Read (Ctx.P.Message_2_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -224,17 +228,23 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_1_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
when C_I_2 =>
case Ctx.P.Next_State is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_2_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
when C_O =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end Write;

Original file line number Diff line number Diff line change
@@ -140,13 +140,17 @@ is
Buffer := (others => 0);
case Chan is
when C_I =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
when C_O =>
case Ctx.P.Next_State is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -179,10 +183,14 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
when C_O =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end Write;

Original file line number Diff line number Diff line change
@@ -791,7 +791,9 @@ is
when S_Send_1 | S_Send_2 =>
Universal_Option_Read (Ctx.P.First_Option_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -824,7 +826,9 @@ is
when S_Recv =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -444,7 +444,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -477,7 +479,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -750,7 +750,9 @@ is
when S_Send_2 =>
Universal_Message_Read (Ctx.P.Message_2_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
Original file line number Diff line number Diff line change
@@ -197,7 +197,9 @@ is
when S_Reply =>
Universal_Option_Read (Ctx.P.Inner_Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -230,7 +232,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -336,15 +336,19 @@ is
Buffer := (others => 0);
case Chan is
when C_I =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
when C_O =>
case Ctx.P.Next_State is
when S_Reply =>
Messages_Msg_LE_Read (Ctx.P.Out_Msg_Ctx);
when S_Reply2 =>
Messages_Msg_Read (Ctx.P.Out_Msg2_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -380,10 +384,14 @@ is
when S_Read2 =>
Messages_Msg_LE_Write (Ctx.P.In_Msg2_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
when C_O =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end Write;

Original file line number Diff line number Diff line change
@@ -311,7 +311,9 @@ is
when S_Reply | S_Reply_2 =>
Test_Definite_Message_Read (Ctx.P.Definite_Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -344,7 +346,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Original file line number Diff line number Diff line change
@@ -255,7 +255,9 @@ is
when S_Reply =>
Universal_Message_Read (Ctx.P.Message_Ctx);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Read;
@@ -288,7 +290,9 @@ is
when S_Start =>
Universal_Message_Write (Ctx.P.Message_Ctx, Offset);
when others =>
pragma Warnings (Off, "unreachable code");
null;
pragma Warnings (On, "unreachable code");
end case;
end case;
end Write;
Loading

0 comments on commit 95ec24e

Please sign in to comment.