diff mbox

[Ada] Remove unreachable code in Freeze_Array_Type

Message ID 20150106103517.GA13763@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 6, 2015, 10:35 a.m. UTC
In the Alias_Atomic_Check block, Complain_CS has these lines:

                        if Known_Static_Esize (Ctyp) then
                           Error_Msg_N
                             ("incorrect component size for "
                              & T & " components", Clause);
                           Error_Msg_Uint_1 := Esize (Ctyp);
                           Error_Msg_N
                             ("\only allowed value is^", Clause);

                        else
                           Error_Msg_N
                             ("component size cannot be given for "
                              & T & " components", Clause);
                        end if;

but Complain_CS can only be invoked if Known_Static_Esize (Ctyp) is true, so 
the above test is always true and the 'else' arm unreachable.

No functional changes.

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-01-06  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb (Freeze_Array_Type) <Complain_CS>: Remove always
	true test and unreachable 'else' arm.
diff mbox

Patch

Index: freeze.adb
===================================================================
--- freeze.adb	(revision 219253)
+++ freeze.adb	(working copy)
@@ -2450,27 +2450,18 @@ 
                           Get_Attribute_Definition_Clause
                             (FS, Attribute_Component_Size);
 
-                        if Known_Static_Esize (Ctyp) then
-                           Error_Msg_N
-                             ("incorrect component size for "
-                              & T & " components", Clause);
-                           Error_Msg_Uint_1 := Esize (Ctyp);
-                           Error_Msg_N
-                             ("\only allowed value is^", Clause);
+                        Error_Msg_N
+                          ("incorrect component size for "
+                           & T & " components", Clause);
+                        Error_Msg_Uint_1 := Esize (Ctyp);
+                        Error_Msg_N
+                          ("\only allowed value is^", Clause);
 
-                        else
-                           Error_Msg_N
-                             ("component size cannot be given for "
-                              & T & " components", Clause);
-                        end if;
-
                      else
                         Error_Msg_N
                           ("cannot pack " & T & " components",
                            Get_Rep_Pragma (FS, Name_Pack));
                      end if;
-
-                     return;
                   end Complain_CS;
 
                   --  Start of processing for Alias_Atomic_Check