This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Ignore pragmas when looking for unreachable code


This patch causes pragmas to be ignored when checking for unreachable
code, which catches additional cases not caught before, as shown by
the following example, compiled with -gnatwe.w -gnatld7

     1. with Ada.Text_IO; use Ada.Text_IO;
     2. procedure Main4 is
     3. begin
     4.    loop
     5.       Put_Line ("Main");
     6.    end loop;
     7.
     8.    pragma List (On);
     9.    Put_Line ("end");
           |
        >>> warning: unreachable code

    10. end Main4;

This also fixes an anomoly that trying to suppress the warning with
pragma Warnings (Off, text) did not work, since the pragma itself
killed the warning.

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

2012-04-26  Robert Dewar  <dewar@adacore.com>

	* sem_ch5.adb (Check_Unreachable_Code): Skip past pragmas.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]