[COMMITTED] ada: Move warnings switches -- initial work
Checks
Commit Message
From: Bob Duff <duff@adacore.com>
This patch prepares to move warning switches from Opt into Warnsw.
gcc/ada/
* warnsw.ads, warnsw.adb, fe.h, err_vars.ads, errout.ads: Move
Warning_Doc_Switch from Err_Vars to Warnsw. Access
Warn_On_Questionable_Layout on the C side via a function rather
than a variable, because we plan to turn the variables into
renamings, and you can't Export renamings.
* erroutc.adb, switch-c.adb, errout.adb: Likewise.
* gcc-interface/decl.cc: Use Get_Warn_On_Questionable_Layout
instead of Warn_On_Questionable_Layout.
* gcc-interface/Makefile.in (GNATMAKE_OBJS): Add warnsw.o, because
it is indirectly imported via Errout.
* gcc-interface/Make-lang.in (GNATBIND_OBJS): Likewise and remove
restrict.o (not needed).
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/err_vars.ads | 6 ------
gcc/ada/errout.adb | 2 ++
gcc/ada/errout.ads | 9 ---------
gcc/ada/erroutc.adb | 1 +
gcc/ada/fe.h | 4 ++--
gcc/ada/gcc-interface/Make-lang.in | 2 +-
gcc/ada/gcc-interface/Makefile.in | 2 +-
gcc/ada/gcc-interface/decl.cc | 2 +-
gcc/ada/switch-c.adb | 1 -
gcc/ada/warnsw.adb | 1 -
gcc/ada/warnsw.ads | 13 ++++++++++++-
11 files changed, 20 insertions(+), 23 deletions(-)
@@ -81,12 +81,6 @@ package Err_Vars is
-- Source_Reference line, then this is initialized to No_Source_File,
-- to force an initial reference to the real source file name.
- Warning_Doc_Switch : Boolean := True;
- -- If this is set True, then the ??/?x?/?x? sequences in error messages
- -- are active (see errout.ads for details). If this switch is False, then
- -- these sequences are ignored (i.e. simply equivalent to a single ?). The
- -- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
-
----------------------------------------
-- Error Message Insertion Parameters --
----------------------------------------
@@ -53,6 +53,8 @@ with Stand; use Stand;
with Stylesw; use Stylesw;
with System.OS_Lib;
with Uname; use Uname;
+with Warnsw; pragma Unreferenced (Warnsw);
+-- Will be referenced when various flags are moved to Warnsw.
package body Errout is
@@ -59,15 +59,6 @@ package Errout is
Error_Msg_Exception : exception renames Err_Vars.Error_Msg_Exception;
-- Exception raised if Raise_Exception_On_Error is true
- Warning_Doc_Switch : Boolean renames Err_Vars.Warning_Doc_Switch;
- -- If this is set True, then the ??/?*?/?$?/?x?/?.x?/?_x? insertion
- -- sequences in error messages generate appropriate tags for the output
- -- error messages. If this switch is False, then these sequences are still
- -- recognized (for the purposes of implementing the pattern matching in
- -- pragmas Warnings (Off,..) and Warning_As_Error(...) but do not result
- -- in adding the error message tag. The -gnatw.d switch sets this flag
- -- True, -gnatw.D sets this flag False.
-
Current_Node : Node_Id := Empty;
-- Used by Error_Msg as a default Node_Id.
-- Relevant only when Opt.Include_Subprogram_In_Messages is set.
@@ -44,6 +44,7 @@ with Stringt; use Stringt;
with Targparm;
with Uintp; use Uintp;
with Widechar; use Widechar;
+with Warnsw; use Warnsw;
package body Erroutc is
@@ -366,9 +366,9 @@ extern Boolean Stack_Check_Probes_On_Target;
/* warnsw: */
-#define Warn_On_Questionable_Layout warnsw__warn_on_questionable_layout
+#define Get_Warn_On_Questionable_Layout warnsw__get_warn_on_questionable_layout
-extern Boolean Warn_On_Questionable_Layout;
+extern Boolean Get_Warn_On_Questionable_Layout ();
// The following corresponds to Ada code in Einfo.Utils.
@@ -601,7 +601,6 @@ GNATBIND_OBJS = \
ada/osint-b.o \
ada/osint.o \
ada/output.o \
- ada/restrict.o \
ada/rident.o \
ada/scans.o \
ada/scil_ll.o \
@@ -629,6 +628,7 @@ GNATBIND_OBJS = \
ada/uintp.o \
ada/uname.o \
ada/urealp.o \
+ ada/warnsw.o \
ada/widechar.o \
ada/gnat.o \
ada/g-dynhta.o \
@@ -333,7 +333,7 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \
snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \
switch.o switch-m.o table.o targparm.o tempdir.o types.o uintp.o \
- uname.o urealp.o usage.o widechar.o \
+ uname.o urealp.o usage.o widechar.o warnsw.o \
seinfo.o einfo-entities.o einfo-utils.o sinfo-nodes.o sinfo-utils.o \
$(EXTRA_GNATMAKE_OBJS)
@@ -8363,7 +8363,7 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type,
&& !Debug_Flag_Dot_R);
const bool w_reorder
= (Convention (gnat_record_type) == Convention_Ada
- && Warn_On_Questionable_Layout
+ && Get_Warn_On_Questionable_Layout ()
&& !(No_Reordering (gnat_record_type) && GNAT_Mode));
tree gnu_zero_list = NULL_TREE;
tree gnu_self_list = NULL_TREE;
@@ -28,7 +28,6 @@
-- circularities, especially for back ends using Adabkend.
with Debug; use Debug;
-with Errout; use Errout;
with Lib; use Lib;
with Osint; use Osint;
with Opt; use Opt;
@@ -23,7 +23,6 @@
-- --
------------------------------------------------------------------------------
-with Err_Vars; use Err_Vars;
with Opt; use Opt;
with Output; use Output;
@@ -38,6 +38,15 @@ package Warnsw is
-- here as time goes by. And in fact a really nice idea would be to put
-- them all in a Warn_Record so that they would be easy to save/restore.
+ Warning_Doc_Switch : Boolean := True;
+ -- If this is set True, then the ??/?*?/?$?/?x?/?.x?/?_x? insertion
+ -- sequences in error messages generate appropriate tags for the output
+ -- error messages. If this switch is False, then these sequences are still
+ -- recognized (for the purposes of implementing the pattern matching in
+ -- pragmas Warnings (Off,..) and Warning_As_Error(...) but do not result
+ -- in adding the error message tag. The -gnatw.d switch sets this flag
+ -- True, -gnatw.D sets this flag False.
+
Warn_On_Anonymous_Allocators : Boolean := False;
-- Warn when allocators for anonymous access types are present, which,
-- although not illegal in Ada, may be confusing to users due to how
@@ -71,7 +80,9 @@ package Warnsw is
-- efficiency reasons and would be improved by reordering the components.
-- Off by default, modified by use of -gnatw.q/.Q (but not -gnatwa).
- -- WARNING: There is a matching C declaration of this variable in fe.h
+ function Get_Warn_On_Questionable_Layout return Boolean is
+ (Warn_On_Questionable_Layout);
+ -- WARNING: There is a matching C declaration of this function in fe.h
Warn_On_Record_Holes : Boolean := False;
-- Warn when explicit record component clauses leave uncovered holes (gaps)