From 95ec24ea339213fee4e64077c6168427b72dd96d Mon Sep 17 00:00:00 2001 From: Tobias Reiher Date: Tue, 16 Aug 2022 18:19:58 +0200 Subject: [PATCH] Suppress warnings about inevitable unreachable code Ref. #1131 --- rflx/generator/session.py | 28 +++++++++++++++++++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 2 ++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 10 +++++++ .../generated/rflx-test-session.adb | 8 ++++++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 2 ++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 8 ++++++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-b-session.adb | 2 ++ .../generated/rflx-test-session.adb | 2 ++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 2 ++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ .../generated/rflx-test-session.adb | 4 +++ 26 files changed, 132 insertions(+) diff --git a/rflx/generator/session.py b/rflx/generator/session.py index a0439c161..78c21ce6d 100644 --- a/rflx/generator/session.py +++ b/rflx/generator/session.py @@ -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"), + ], + ), ], ), ], diff --git a/tests/integration/messages_with_implict_size/generated/rflx-test-session.adb b/tests/integration/messages_with_implict_size/generated/rflx-test-session.adb index 9250ae300..1ffc99ca9 100644 --- a/tests/integration/messages_with_implict_size/generated/rflx-test-session.adb +++ b/tests/integration/messages_with_implict_size/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/messages_with_single_opaque_field/generated/rflx-test-session.adb b/tests/integration/messages_with_single_opaque_field/generated/rflx-test-session.adb index e8eca9a61..ff93b5d9c 100644 --- a/tests/integration/messages_with_single_opaque_field/generated/rflx-test-session.adb +++ b/tests/integration/messages_with_single_opaque_field/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/parameterized_messages/generated/rflx-test-session.adb b/tests/integration/parameterized_messages/generated/rflx-test-session.adb index 267aeb4b2..4abe22eb1 100644 --- a/tests/integration/parameterized_messages/generated/rflx-test-session.adb +++ b/tests/integration/parameterized_messages/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_append_unconstrained/generated/rflx-test-session.adb b/tests/integration/session_append_unconstrained/generated/rflx-test-session.adb index 9387b0ee6..8a5ee6195 100644 --- a/tests/integration/session_append_unconstrained/generated/rflx-test-session.adb +++ b/tests/integration/session_append_unconstrained/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_binding/generated/rflx-test-session.adb b/tests/integration/session_binding/generated/rflx-test-session.adb index c2c4a59e3..87f5a48e4 100644 --- a/tests/integration/session_binding/generated/rflx-test-session.adb +++ b/tests/integration/session_binding/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_case_expression_aggregate/generated/rflx-test-session.adb b/tests/integration/session_case_expression_aggregate/generated/rflx-test-session.adb index 0bd0cef2b..ece58b0ed 100644 --- a/tests/integration/session_case_expression_aggregate/generated/rflx-test-session.adb +++ b/tests/integration/session_case_expression_aggregate/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_case_expression_numeric/generated/rflx-test-session.adb b/tests/integration/session_case_expression_numeric/generated/rflx-test-session.adb index 68299ea74..409409d60 100644 --- a/tests/integration/session_case_expression_numeric/generated/rflx-test-session.adb +++ b/tests/integration/session_case_expression_numeric/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_channel_multiplexing/generated/rflx-test-session.adb b/tests/integration/session_channel_multiplexing/generated/rflx-test-session.adb index e540b5c88..a0ccde300 100644 --- a/tests/integration/session_channel_multiplexing/generated/rflx-test-session.adb +++ b/tests/integration/session_channel_multiplexing/generated/rflx-test-session.adb @@ -183,7 +183,9 @@ 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 => @@ -191,7 +193,9 @@ is 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; diff --git a/tests/integration/session_channels/generated/rflx-test-session.adb b/tests/integration/session_channels/generated/rflx-test-session.adb index e7a924f7f..d7915ecde 100644 --- a/tests/integration/session_channels/generated/rflx-test-session.adb +++ b/tests/integration/session_channels/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_comprehension_head/generated/rflx-test-session.adb b/tests/integration/session_comprehension_head/generated/rflx-test-session.adb index bad9933f9..e58497f16 100644 --- a/tests/integration/session_comprehension_head/generated/rflx-test-session.adb +++ b/tests/integration/session_comprehension_head/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_comprehension_on_message_field/generated/rflx-test-session.adb b/tests/integration/session_comprehension_on_message_field/generated/rflx-test-session.adb index 7d3ad647e..b331a1e7b 100644 --- a/tests/integration/session_comprehension_on_message_field/generated/rflx-test-session.adb +++ b/tests/integration/session_comprehension_on_message_field/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_comprehension_on_sequence/generated/rflx-test-session.adb b/tests/integration/session_comprehension_on_sequence/generated/rflx-test-session.adb index f29d6df33..a9537da16 100644 --- a/tests/integration/session_comprehension_on_sequence/generated/rflx-test-session.adb +++ b/tests/integration/session_comprehension_on_sequence/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_conversion/generated/rflx-test-session.adb b/tests/integration/session_conversion/generated/rflx-test-session.adb index 70627ff33..fa84ea48c 100644 --- a/tests/integration/session_conversion/generated/rflx-test-session.adb +++ b/tests/integration/session_conversion/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_endianness/generated/rflx-test-session.adb b/tests/integration/session_endianness/generated/rflx-test-session.adb index c410d68f2..5a444b806 100644 --- a/tests/integration/session_endianness/generated/rflx-test-session.adb +++ b/tests/integration/session_endianness/generated/rflx-test-session.adb @@ -336,7 +336,9 @@ 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 => @@ -344,7 +346,9 @@ is 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; diff --git a/tests/integration/session_functions/generated/rflx-test-session.adb b/tests/integration/session_functions/generated/rflx-test-session.adb index 585addabd..2f471b1fc 100644 --- a/tests/integration/session_functions/generated/rflx-test-session.adb +++ b/tests/integration/session_functions/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_integration/generated/rflx-test-session.adb b/tests/integration/session_integration/generated/rflx-test-session.adb index 3a5c02550..b6da1b754 100644 --- a/tests/integration/session_integration/generated/rflx-test-session.adb +++ b/tests/integration/session_integration/generated/rflx-test-session.adb @@ -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; diff --git a/tests/integration/session_integration_multiple/generated/rflx-b-session.adb b/tests/integration/session_integration_multiple/generated/rflx-b-session.adb index 98d82a893..ae458eaec 100644 --- a/tests/integration/session_integration_multiple/generated/rflx-b-session.adb +++ b/tests/integration/session_integration_multiple/generated/rflx-b-session.adb @@ -125,7 +125,9 @@ is when S_Start => Universal_Message_Write (Ctx.P.M_Ctx, Offset); when others => + pragma Warnings (Off, "unreachable code"); null; + pragma Warnings (On, "unreachable code"); end case; end case; end Write; diff --git a/tests/integration/session_integration_multiple/generated/rflx-test-session.adb b/tests/integration/session_integration_multiple/generated/rflx-test-session.adb index 49e6ab763..720646188 100644 --- a/tests/integration/session_integration_multiple/generated/rflx-test-session.adb +++ b/tests/integration/session_integration_multiple/generated/rflx-test-session.adb @@ -125,7 +125,9 @@ is when S_Start => Universal_Message_Write (Ctx.P.M_Ctx, Offset); when others => + pragma Warnings (Off, "unreachable code"); null; + pragma Warnings (On, "unreachable code"); end case; end case; end Write; diff --git a/tests/integration/session_minimal/generated/rflx-test-session.adb b/tests/integration/session_minimal/generated/rflx-test-session.adb index 2a1c285c1..30b4878c3 100644 --- a/tests/integration/session_minimal/generated/rflx-test-session.adb +++ b/tests/integration/session_minimal/generated/rflx-test-session.adb @@ -144,7 +144,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; @@ -177,7 +179,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; diff --git a/tests/integration/session_reuse_of_message/generated/rflx-test-session.adb b/tests/integration/session_reuse_of_message/generated/rflx-test-session.adb index 25faa6d8e..737f5a2da 100644 --- a/tests/integration/session_reuse_of_message/generated/rflx-test-session.adb +++ b/tests/integration/session_reuse_of_message/generated/rflx-test-session.adb @@ -144,7 +144,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; @@ -177,7 +179,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; diff --git a/tests/integration/session_sequence_append/generated/rflx-test-session.adb b/tests/integration/session_sequence_append/generated/rflx-test-session.adb index 20e1a5613..9dc58e750 100644 --- a/tests/integration/session_sequence_append/generated/rflx-test-session.adb +++ b/tests/integration/session_sequence_append/generated/rflx-test-session.adb @@ -333,7 +333,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; @@ -366,7 +368,9 @@ is when S_Start => Universal_Option_Write (Ctx.P.Option_Ctx, Offset); when others => + pragma Warnings (Off, "unreachable code"); null; + pragma Warnings (On, "unreachable code"); end case; end case; end Write; diff --git a/tests/integration/session_sequence_append_head/generated/rflx-test-session.adb b/tests/integration/session_sequence_append_head/generated/rflx-test-session.adb index b50fb2f97..c6fa5ee1c 100644 --- a/tests/integration/session_sequence_append_head/generated/rflx-test-session.adb +++ b/tests/integration/session_sequence_append_head/generated/rflx-test-session.adb @@ -658,7 +658,9 @@ is when S_Reply_1 | S_Reply_2 => TLV_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; diff --git a/tests/integration/session_setting_of_message_fields/generated/rflx-test-session.adb b/tests/integration/session_setting_of_message_fields/generated/rflx-test-session.adb index 64e7fb176..b04933857 100644 --- a/tests/integration/session_setting_of_message_fields/generated/rflx-test-session.adb +++ b/tests/integration/session_setting_of_message_fields/generated/rflx-test-session.adb @@ -235,7 +235,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; @@ -268,7 +270,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; diff --git a/tests/integration/session_simple/generated/rflx-test-session.adb b/tests/integration/session_simple/generated/rflx-test-session.adb index 9f680900a..b7c85c442 100644 --- a/tests/integration/session_simple/generated/rflx-test-session.adb +++ b/tests/integration/session_simple/generated/rflx-test-session.adb @@ -192,7 +192,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; @@ -225,7 +227,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; diff --git a/tests/integration/session_variable_initialization/generated/rflx-test-session.adb b/tests/integration/session_variable_initialization/generated/rflx-test-session.adb index 662594642..0933b74a5 100644 --- a/tests/integration/session_variable_initialization/generated/rflx-test-session.adb +++ b/tests/integration/session_variable_initialization/generated/rflx-test-session.adb @@ -194,7 +194,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; @@ -227,7 +229,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;