Skip to content

Commit

Permalink
Suppress warnings about inevitable unreachable code
Browse files Browse the repository at this point in the history
Ref. #1131
  • Loading branch information
treiher committed Aug 19, 2022
1 parent 73c85f4 commit 7d8796a
Show file tree
Hide file tree
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
Expand Up @@ -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"),
],
),
],
),
],
Expand Down Expand Up @@ -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"),
],
),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 7d8796a

Please sign in to comment.