1------------------------------------------------------------------------------ 2-- -- 3-- GNAT COMPILER COMPONENTS -- 4-- -- 5-- W A R N S W -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 1999-2012, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 17-- for more details. You should have received a copy of the GNU General -- 18-- Public License distributed with GNAT; see file COPYING3. If not, go to -- 19-- http://www.gnu.org/licenses for a complete copy of the license. -- 20-- -- 21-- GNAT was originally developed by the GNAT team at New York University. -- 22-- Extensive contributions were provided by Ada Core Technologies Inc. -- 23-- -- 24------------------------------------------------------------------------------ 25 26-- This unit contains the routines used to handle setting of warning options 27 28package Warnsw is 29 30 ------------------- 31 -- Warning Flags -- 32 ------------------- 33 34 -- These flags are activated or deactivated by -gnatw switches and control 35 -- whether warnings of a given class will be generated or not. 36 37 -- Note: most of these flags are still in opt, but the plan is to move them 38 -- here as time goes by. 39 40 Warn_On_Record_Holes : Boolean := False; 41 -- Warn when explicit record component clauses leave uncovered holes (gaps) 42 -- in a record layout. Off by default, set by -gnatw.h (but not -gnatwa). 43 44 Warn_On_Overridden_Size : Boolean := False; 45 -- Warn when explicit record component clause or array component_size 46 -- clause specifies a size that overrides a size for the typen which was 47 -- set with an explicit size clause. Off by default, modified by use of 48 -- -gnatw.s/.S, but not set by -gnatwa. 49 50 Warn_On_Standard_Redefinition : Boolean := False; 51 -- Warn when a program defines an identifier that matches a name in 52 -- Standard. Off by default, modified by use of -gnatw.k/.K, but not 53 -- affected by -gnatwa. 54 55 ----------------- 56 -- Subprograms -- 57 ----------------- 58 59 function Set_Warning_Switch (C : Character) return Boolean; 60 -- This function sets the warning switch or switches corresponding to the 61 -- given character. It is used to process a -gnatw switch on the command 62 -- line, or a character in a string literal in pragma Warnings. Returns 63 -- True for valid warning character C, False for invalid character. 64 65 function Set_Dot_Warning_Switch (C : Character) return Boolean; 66 -- This function sets the warning switch or switches corresponding to the 67 -- given character preceded by a dot. Used to process a -gnatw. switch on 68 -- the command line or .C in a string literal in pragma Warnings. Returns 69 -- True for valid warning character C, False for invalid character. 70 71 procedure Set_GNAT_Mode_Warnings; 72 -- This is called in -gnatg mode to set the warnings for gnat mode. It is 73 -- also used to set the proper warning statuses for -gnatw.g. Note that 74 -- this set of warnings is disjoint from -gnatwa, it enables warnings that 75 -- are not included in -gnatwa, and it disables warnings that are included 76 -- in -gnatwa (such as Warn_On_Implementation_Units, which we clearly want 77 -- to be False for units built with -gnatg). 78 79end Warnsw; 80