This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Eliminate redundant tests
- From: Matt Kraai <kraai at alumni dot cmu dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 13 Jun 2003 14:03:08 -0700
- Subject: Eliminate redundant tests
Howdy,
Gen_Main_Ada and Gen_Main_C are only called if Bind_Main_Program
is true, so their tests of Bind_Main_Program are redundant. The
following patch removes the tests.
Bootstrapped and regression tested on powerpc-unknown-linux-gnu.
OK to commit?
--
Matt Kraai <kraai@alumni.cmu.edu>
Debian GNU/Linux Peon
* bindgen.adb (Gen_Main_Ada, Gen_Main_C): Do not test
Bind_Main_Program.
Index: gcc/ada/bindgen.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/bindgen.adb,v
retrieving revision 1.12
diff -3 -c -p -r1.12 bindgen.adb
*** gcc/ada/bindgen.adb 6 Jun 2003 04:50:08 -0000 1.12
--- gcc/ada/bindgen.adb 13 Jun 2003 11:08:34 -0000
*************** package body Bindgen is
*** 1245,1256 ****
-- The reference stops Ada_Main_Program_Name from being optimized
-- away by smart linkers, such as the AiX linker.
! if Bind_Main_Program then
! WBI
! (" Ensure_Reference : System.Address := " &
! "Ada_Main_Program_Name'Address;");
! WBI ("");
! end if;
WBI (" begin");
--- 1245,1254 ----
-- The reference stops Ada_Main_Program_Name from being optimized
-- away by smart linkers, such as the AiX linker.
! WBI
! (" Ensure_Reference : System.Address := " &
! "Ada_Main_Program_Name'Address;");
! WBI ("");
WBI (" begin");
*************** package body Bindgen is
*** 1366,1377 ****
-- place). The reference stops Ada_Main_Program_Name from being
-- optimized away by smart linkers, such as the AiX linker.
! if Bind_Main_Program then
! WBI
! (" char *ensure_reference __attribute__ ((__unused__)) = " &
! "__gnat_ada_main_program_name;");
! WBI ("");
! end if;
if ALIs.Table (ALIs.First).Main_Program = Func then
WBI (" int result;");
--- 1364,1373 ----
-- place). The reference stops Ada_Main_Program_Name from being
-- optimized away by smart linkers, such as the AiX linker.
! WBI
! (" char *ensure_reference __attribute__ ((__unused__)) = " &
! "__gnat_ada_main_program_name;");
! WBI ("");
if ALIs.Table (ALIs.First).Main_Program = Func then
WBI (" int result;");