2006-10-31 Robert Dewar <dewar@adacore.com> Cyrille Comar <comar@adacore.com> Ben Brosgol <brosgol@adacore.com> * debug.adb: Update flags documentation * gnat_ugn.texi: Add documentation for new -gnatwq switch Clean up documentation for several other warning switches Clarify how task stack size can be specified with various versions of Windows. Add note that -gnatVo includes ranges including loops Add documentation for -gnatL switch Add note on elaboration warning for initializing variables Add documentation for new -gnatwt warning switch Document new form of pragma Warnings (On|Off, string) Add comment on use of pragma Warnings to control warnings Add documentation for -gnatjnn switch Modify section on interfacing with C for VMS 64-bit. Add doc for -gnatVe/E Add documentation of new warning flags -gnatww/-gnatwW Add warnings about address clause overlays to list of warnings (Exception Handling Control): Document that the option --RTS must be used consistently for gcc and gnatbind. Clarify that inlining is not always possible Update documentation on pragma Unchecked_Union. * gnat_rm.texi: Add documentation for new extended version of pragma Obsolescent Add documentation for implementation defined attribute 'Stub_Type. Add note on use of Volatile in asm statements Add documentation on use of pragma Unreferenced in context clause Document new form of pragma Warnings (On|Off, pattern) Document pragma Wide_Character_Encoding Add note that pragma Restrictions (No_Elaboration_Code) is only fully enforced if code generation is active. Add section on pragma Suppress to document GNAT specific check Alignment_Check Clarify difference between No_Dispatching_Calls & No_Dispatch. Add documentation for pragma Restrictions (No_Elaboration_Code) * gnat-style.texi: Add comments on layout of subprogram local variables in the presence of nested subprograms. * ug_words: Resync. * elists.ads: Minor reformatting Node returns Node_Or_Entity_Id (doc change only) * xgnatugn.adb: Replace ACADEMICEDITION with GPLEDITION * g-arrspl.ads (Create): Update comments. * sem.ads: Add details on the handling of the scope stack. * usage.adb: Update documentation. * validsw.ads, validsw.adb: Add definition of Validity_Check_Components and implement -gnatVe/E * vms_data.ads: Add missing VMS qualifiers. * s-addope.ads: Add documentation on overflow and divide by zero From-SVN: r118328
243 lines
8.1 KiB
Ada
243 lines
8.1 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT COMPILER COMPONENTS --
|
|
-- --
|
|
-- V A L I D S W --
|
|
-- --
|
|
-- B o d y --
|
|
-- --
|
|
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
|
|
-- --
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
-- ware Foundation; either version 2, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
-- Public License distributed with GNAT; see file COPYING. If not, write --
|
|
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
|
|
-- Boston, MA 02110-1301, USA. --
|
|
-- --
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
with Opt; use Opt;
|
|
|
|
package body Validsw is
|
|
|
|
----------------------------------
|
|
-- Reset_Validity_Check_Options --
|
|
----------------------------------
|
|
|
|
procedure Reset_Validity_Check_Options is
|
|
begin
|
|
Validity_Check_Components := False;
|
|
Validity_Check_Copies := False;
|
|
Validity_Check_Default := True;
|
|
Validity_Check_Floating_Point := False;
|
|
Validity_Check_In_Out_Params := False;
|
|
Validity_Check_In_Params := False;
|
|
Validity_Check_Operands := False;
|
|
Validity_Check_Returns := False;
|
|
Validity_Check_Subscripts := False;
|
|
Validity_Check_Tests := False;
|
|
end Reset_Validity_Check_Options;
|
|
|
|
---------------------------------
|
|
-- Save_Validity_Check_Options --
|
|
---------------------------------
|
|
|
|
procedure Save_Validity_Check_Options
|
|
(Options : out Validity_Check_Options)
|
|
is
|
|
P : Natural := 0;
|
|
|
|
procedure Add (C : Character; S : Boolean);
|
|
-- Add given character C to string if switch S is true
|
|
|
|
procedure Add (C : Character; S : Boolean) is
|
|
begin
|
|
if S then
|
|
P := P + 1;
|
|
Options (P) := C;
|
|
end if;
|
|
end Add;
|
|
|
|
-- Start of processing for Save_Validity_Check_Options
|
|
|
|
begin
|
|
for K in Options'Range loop
|
|
Options (K) := ' ';
|
|
end loop;
|
|
|
|
Add ('n', not Validity_Check_Default);
|
|
|
|
Add ('c', Validity_Check_Copies);
|
|
Add ('e', Validity_Check_Components);
|
|
Add ('f', Validity_Check_Floating_Point);
|
|
Add ('i', Validity_Check_In_Params);
|
|
Add ('m', Validity_Check_In_Out_Params);
|
|
Add ('o', Validity_Check_Operands);
|
|
Add ('r', Validity_Check_Returns);
|
|
Add ('s', Validity_Check_Subscripts);
|
|
Add ('t', Validity_Check_Tests);
|
|
end Save_Validity_Check_Options;
|
|
|
|
----------------------------------------
|
|
-- Set_Default_Validity_Check_Options --
|
|
----------------------------------------
|
|
|
|
procedure Set_Default_Validity_Check_Options is
|
|
begin
|
|
Reset_Validity_Check_Options;
|
|
Set_Validity_Check_Options ("d");
|
|
end Set_Default_Validity_Check_Options;
|
|
|
|
--------------------------------
|
|
-- Set_Validity_Check_Options --
|
|
--------------------------------
|
|
|
|
-- Version used when no error checking is required
|
|
|
|
procedure Set_Validity_Check_Options (Options : String) is
|
|
OK : Boolean;
|
|
EC : Natural;
|
|
|
|
begin
|
|
Set_Validity_Check_Options (Options, OK, EC);
|
|
end Set_Validity_Check_Options;
|
|
|
|
-- Normal version with error checking
|
|
|
|
procedure Set_Validity_Check_Options
|
|
(Options : String;
|
|
OK : out Boolean;
|
|
Err_Col : out Natural)
|
|
is
|
|
J : Natural;
|
|
C : Character;
|
|
|
|
begin
|
|
J := Options'First;
|
|
while J <= Options'Last loop
|
|
C := Options (J);
|
|
J := J + 1;
|
|
|
|
-- Turn on validity checking (gets turned off by Vn)
|
|
|
|
Validity_Checks_On := True;
|
|
|
|
case C is
|
|
|
|
when 'c' =>
|
|
Validity_Check_Copies := True;
|
|
|
|
when 'd' =>
|
|
Validity_Check_Default := True;
|
|
|
|
when 'e' =>
|
|
Validity_Check_Components := True;
|
|
|
|
when 'f' =>
|
|
Validity_Check_Floating_Point := True;
|
|
|
|
when 'i' =>
|
|
Validity_Check_In_Params := True;
|
|
|
|
when 'm' =>
|
|
Validity_Check_In_Out_Params := True;
|
|
|
|
when 'o' =>
|
|
Validity_Check_Operands := True;
|
|
|
|
when 'p' =>
|
|
Validity_Check_Parameters := True;
|
|
|
|
when 'r' =>
|
|
Validity_Check_Returns := True;
|
|
|
|
when 's' =>
|
|
Validity_Check_Subscripts := True;
|
|
|
|
when 't' =>
|
|
Validity_Check_Tests := True;
|
|
|
|
when 'C' =>
|
|
Validity_Check_Copies := False;
|
|
|
|
when 'D' =>
|
|
Validity_Check_Default := False;
|
|
|
|
when 'E' =>
|
|
Validity_Check_Components := False;
|
|
|
|
when 'I' =>
|
|
Validity_Check_In_Params := False;
|
|
|
|
when 'F' =>
|
|
Validity_Check_Floating_Point := False;
|
|
|
|
when 'M' =>
|
|
Validity_Check_In_Out_Params := False;
|
|
|
|
when 'O' =>
|
|
Validity_Check_Operands := False;
|
|
|
|
when 'P' =>
|
|
Validity_Check_Parameters := False;
|
|
|
|
when 'R' =>
|
|
Validity_Check_Returns := False;
|
|
|
|
when 'S' =>
|
|
Validity_Check_Subscripts := False;
|
|
|
|
when 'T' =>
|
|
Validity_Check_Tests := False;
|
|
|
|
when 'a' =>
|
|
Validity_Check_Components := True;
|
|
Validity_Check_Copies := True;
|
|
Validity_Check_Default := True;
|
|
Validity_Check_Floating_Point := True;
|
|
Validity_Check_In_Out_Params := True;
|
|
Validity_Check_In_Params := True;
|
|
Validity_Check_Operands := True;
|
|
Validity_Check_Parameters := True;
|
|
Validity_Check_Returns := True;
|
|
Validity_Check_Subscripts := True;
|
|
Validity_Check_Tests := True;
|
|
|
|
when 'n' =>
|
|
Validity_Check_Components := False;
|
|
Validity_Check_Copies := False;
|
|
Validity_Check_Default := False;
|
|
Validity_Check_Floating_Point := False;
|
|
Validity_Check_In_Out_Params := False;
|
|
Validity_Check_In_Params := False;
|
|
Validity_Check_Operands := False;
|
|
Validity_Check_Parameters := False;
|
|
Validity_Check_Returns := False;
|
|
Validity_Check_Subscripts := False;
|
|
Validity_Check_Tests := False;
|
|
Validity_Checks_On := False;
|
|
|
|
when ' ' =>
|
|
null;
|
|
|
|
when others =>
|
|
OK := False;
|
|
Err_Col := J - 1;
|
|
return;
|
|
end case;
|
|
end loop;
|
|
|
|
OK := True;
|
|
Err_Col := Options'Last + 1;
|
|
end Set_Validity_Check_Options;
|
|
|
|
end Validsw;
|