Commit e1b871e9 by Arnaud Charlet

[multiple changes]

2010-06-17  Robert Dewar  <dewar@adacore.com>

	* back_end.adb, sem_res.adb, switch-c.adb, sem_scil.adb: Minor
	reformatting.
	* sem_attr.adb, sem_cat.adb, sem_disp.adb, sem_elab.adb, sem_elim.adb,
	sem_eval.adb: Use Ekind_In

2010-06-17  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb: better error message for illegal inherited discriminant

2010-06-17  Vincent Celier  <celier@adacore.com>

	* bindusg.adb: Remove lines for -A and -C
	* gnat_ugn.texi: Remove all documentation and examples of switches -A
	and -C for gnatbind and gnatlink.
	* gnatlink.adb (Usage): Remove lines for -A and -C
	* switch-b.adb (Scan_Binder_Switches): Issue warning when switch -C is
	specified.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r160891
parent 67e740fa
2010-06-17 Robert Dewar <dewar@adacore.com>
* back_end.adb, sem_res.adb, switch-c.adb, sem_scil.adb: Minor
reformatting.
* sem_attr.adb, sem_cat.adb, sem_disp.adb, sem_elab.adb, sem_elim.adb,
sem_eval.adb: Use Ekind_In
2010-06-17 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb: better error message for illegal inherited discriminant
2010-06-17 Vincent Celier <celier@adacore.com>
* bindusg.adb: Remove lines for -A and -C
* gnat_ugn.texi: Remove all documentation and examples of switches -A
and -C for gnatbind and gnatlink.
* gnatlink.adb (Usage): Remove lines for -A and -C
* switch-b.adb (Scan_Binder_Switches): Issue warning when switch -C is
specified.
* gcc-interface/Make-lang.in: Update dependencies.
2010-06-17 Vincent Celier <celier@adacore.com>
* back_end.adb (Scan_Compiler_Arguments): Put all arguments in new
......
......@@ -244,7 +244,6 @@ package body Back_End is
Argv_Len : constant Nat := Len_Arg (Arg);
Argv : constant String :=
Argv_Ptr (1 .. Natural (Argv_Len));
begin
Args (Positive (Arg)) := new String'(Argv);
end;
......
......@@ -73,10 +73,6 @@ package body Bindusg is
Write_Line (" -a Automatically initialize elaboration " &
"procedure");
-- Line for A switch
Write_Line (" -A Generate binder program in Ada (default)");
-- Line for -b switch
Write_Line (" -b Generate brief messages to stderr " &
......@@ -87,10 +83,6 @@ package body Bindusg is
Write_Line (" -c Check only, no generation of " &
"binder output file");
-- Line for C switch
Write_Line (" -C Generate binder program in C");
-- Line for -d switch
Write_Line (" -dnn[k|m] Default primary stack " &
......
......@@ -4193,17 +4193,16 @@ ada/switch-b.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/switch-c.o : ada/ada.ads ada/a-comlin.ads ada/a-except.ads \
ada/a-unccon.ads ada/a-uncdea.ads ada/alloc.ads ada/debug.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/namet.ads ada/opt.ads \
ada/osint.ads ada/output.ads ada/prepcomp.ads ada/sem_warn.ads \
ada/stylesw.ads ada/switch.ads ada/switch-c.ads ada/switch-c.adb \
ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
ada/unchdeal.ads ada/validsw.ads
ada/switch-c.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/lib.ads ada/namet.ads ada/opt.ads ada/osint.ads \
ada/output.ads ada/prepcomp.ads ada/sem_warn.ads ada/stylesw.ads \
ada/switch.ads ada/switch-c.ads ada/switch-c.adb ada/system.ads \
ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/validsw.ads
ada/switch.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnatvsn.ads \
......
......@@ -7927,7 +7927,7 @@ $ gnatbind @r{[}@var{switches}@r{]} @var{mainprog}@r{[}.ali@r{]} @r{[}@var{switc
@noindent
where @file{@var{mainprog}.adb} is the Ada file containing the main program
unit body. If no switches are specified, @code{gnatbind} constructs an Ada
unit body. @code{gnatbind} constructs an Ada
package in two files whose names are
@file{b~@var{mainprog}.ads}, and @file{b~@var{mainprog}.adb}.
For example, if given the
......@@ -7998,14 +7998,6 @@ the generated main program. It can also be debugged just like any other
Ada code provided the @option{^-g^/DEBUG^} switch is used for
@command{gnatbind} and @command{gnatlink}.
However for some purposes it may be convenient to generate the main
program in C rather than Ada. This may for example be helpful when you
are generating a mixed language program with the main program in C. The
GNAT compiler itself is an example.
The use of the @option{^-C^/BIND_FILE=C^} switch
for both @code{gnatbind} and @command{gnatlink} will cause the program to
be generated in C (and compiled using the gnu C compiler).
@node Switches for gnatbind
@section Switches for @command{gnatbind}
......@@ -8049,10 +8041,6 @@ Specify directory to be searched for ALI files.
@cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind})
Specify directory to be searched for source file.
@item ^-A^/BIND_FILE=ADA^
@cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatbind})
Generate binder program in Ada (default)
@item ^-b^/REPORT_ERRORS=BRIEF^
@cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@command{gnatbind})
Generate brief messages to @file{stderr} even if verbose mode set.
......@@ -8061,10 +8049,6 @@ Generate brief messages to @file{stderr} even if verbose mode set.
@cindex @option{^-c^/NOOUTPUT^} (@command{gnatbind})
Check only, no generation of binder output file.
@item ^-C^/BIND_FILE=C^
@cindex @option{^-C^/BIND_FILE=C^} (@command{gnatbind})
Generate binder program in C
@item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}
@cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind})
This switch can be used to change the default task stack size value
......@@ -8510,24 +8494,11 @@ generated by the binder.
@table @option
@c !sort!
@item ^-A^/BIND_FILE=ADA^
@cindex @option{^-A^/BIND_FILE=ADA^} (@code{gnatbind})
Generate binder program in Ada (default). The binder program is named
@file{b~@var{mainprog}.adb} by default. This can be changed with
@option{^-o^/OUTPUT^} @code{gnatbind} option.
@item ^-c^/NOOUTPUT^
@cindex @option{^-c^/NOOUTPUT^} (@code{gnatbind})
Check only. Do not generate the binder output file. In this mode the
binder performs all error checks but does not generate an output file.
@item ^-C^/BIND_FILE=C^
@cindex @option{^-C^/BIND_FILE=C^} (@code{gnatbind})
Generate binder program in C. The binder program is named
@file{b_@var{mainprog}.c}.
This can be changed with @option{^-o^/OUTPUT^} @code{gnatbind}
option.
@item ^-e^/ELABORATION_DEPENDENCIES^
@cindex @option{^-e^/ELABORATION_DEPENDENCIES^} (@code{gnatbind})
Output complete list of elaboration-order dependencies, showing the
......@@ -8562,8 +8533,7 @@ directory names for the run-time units depend on the system configuration.
@cindex @option{^-o^/OUTPUT^} (@code{gnatbind})
Set name of output file to @var{file} instead of the normal
@file{b~@var{mainprog}.adb} default. Note that @var{file} denote the Ada
binder generated body filename. In C mode you would normally give
@var{file} an extension of @file{.c} because it will be a C source program.
binder generated body filename.
Note that if this option is used, then linking must be done manually.
It is not possible to use gnatlink in this case, since it cannot locate
the binder file.
......@@ -8637,9 +8607,7 @@ more quite separate groups of Ada units.
The binder takes the name of its output file from the last specified ALI
file, unless overridden by the use of the @option{^-o file^/OUTPUT=file^}.
@cindex @option{^-o^/OUTPUT^} (@command{gnatbind})
The output is an Ada unit in source form that can
be compiled with GNAT unless the -C switch is used in which case the
output is a C source file, which must be compiled using the C compiler.
The output is an Ada unit in source form that can be compiled with GNAT.
This compilation occurs automatically as part of the @command{gnatlink}
processing.
......@@ -8836,39 +8804,8 @@ The main program @code{Hello} (source program in @file{hello.adb}) is
bound using the standard switch settings. The generated main program is
@file{mainprog.adb} with the associated spec in
@file{mainprog.ads}. Note that you must specify the body here not the
spec, in the case where the output is in Ada. Note that if this option
is used, then linking must be done manually, since gnatlink will not
be able to find the generated file.
@ifclear vms
@item gnatbind main -C -o mainprog.c -x
@end ifclear
@ifset vms
@item gnatbind MAIN.ALI /BIND_FILE=C /OUTPUT=Mainprog.C /READ_SOURCES=NONE
@end ifset
The main program @code{Main} (source program in
@file{main.adb}) is bound, excluding source files from the
consistency checking, generating
the file @file{mainprog.c}.
@ifclear vms
@item gnatbind -x main_program -C -o mainprog.c
This command is exactly the same as the previous example. Switches may
appear anywhere in the command line, and single letter switches may be
combined into a single switch.
@end ifclear
@ifclear vms
@item gnatbind -n math dbase -C -o ada-control.c
@end ifclear
@ifset vms
@item gnatbind /NOMAIN math dbase /BIND_FILE=C /OUTPUT=ada-control.c
@end ifset
The main program is in a language other than Ada, but calls to
subprograms in packages @code{Math} and @code{Dbase} appear. This call
to @code{gnatbind} generates the file @file{ada-control.c} containing
the @code{adainit} and @code{adafinal} routines to be called before and
after accessing the Ada units.
spec. Note that if this option is used, then linking must be done manually,
since gnatlink will not be able to find the generated file.
@end table
@c ------------------------------------
......@@ -8987,17 +8924,6 @@ Display Copyright and version, then exit disregarding all other options.
If @option{--version} was not used, display usage, then exit disregarding
all other options.
@item ^-A^/BIND_FILE=ADA^
@cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatlink})
The binder has generated code in Ada. This is the default.
@item ^-C^/BIND_FILE=C^
@cindex @option{^-C^/BIND_FILE=C^} (@command{gnatlink})
If instead of generating a file in Ada, the binder has generated one in
C, then the linker needs to know about it. Use this switch to signal
to @command{gnatlink} that the binder has generated C code rather than
Ada code.
@item ^-f^/FORCE_OBJECT_FILE_LIST^
@cindex Command line length
@cindex @option{^-f^/FORCE_OBJECT_FILE_LIST^} (@command{gnatlink})
......@@ -1447,8 +1447,6 @@ procedure Gnatlink is
Write_Eol;
Write_Line (" mainprog.ali the ALI file of the main program");
Write_Eol;
Write_Line (" -A Binder generated source file is in Ada (default)");
Write_Line (" -C Binder generated source file is in C");
Write_Line (" -f force object file list to be generated");
Write_Line (" -g Compile binder source file with debug information");
Write_Line (" -n Do not compile the binder source file");
......
......@@ -2775,10 +2775,8 @@ package body Sem_Attr is
exit;
elsif Ekind (Scope (Ent)) in Task_Kind
and then Ekind (S) /= E_Loop
and then Ekind (S) /= E_Block
and then Ekind (S) /= E_Entry
and then Ekind (S) /= E_Entry_Family
and then
not Ekind_In (S, E_Loop, E_Block, E_Entry, E_Entry_Family)
then
Error_Attr ("Attribute % cannot appear in inner unit", N);
......@@ -7813,11 +7811,9 @@ package body Sem_Attr is
-- also be accessibility checks on those, this is where the
-- checks can eventually be centralized ???
if Ekind (Btyp) = E_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
if Ekind_In (Btyp, E_Access_Subprogram_Type,
E_Anonymous_Access_Subprogram_Type,
E_Anonymous_Access_Protected_Subprogram_Type)
then
-- Deal with convention mismatch
......@@ -8244,9 +8240,8 @@ package body Sem_Attr is
end if;
end if;
if Ekind (Btyp) = E_Access_Protected_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
if Ekind_In (Btyp, E_Access_Protected_Subprogram_Type,
E_Anonymous_Access_Protected_Subprogram_Type)
then
if Is_Entity_Name (P)
and then not Is_Protected_Type (Scope (Entity (P)))
......@@ -8268,9 +8263,8 @@ package body Sem_Attr is
return;
end if;
elsif (Ekind (Btyp) = E_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type)
elsif Ekind_In (Btyp, E_Access_Subprogram_Type,
E_Anonymous_Access_Subprogram_Type)
and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type
then
Error_Msg_F ("context requires a non-protected subprogram", P);
......
......@@ -1397,8 +1397,8 @@ package body Sem_Cat is
null;
elsif Ekind (Param_Type) = E_Anonymous_Access_Type
or else Ekind (Param_Type) = E_Anonymous_Access_Subprogram_Type
elsif Ekind_In (Param_Type, E_Anonymous_Access_Type,
E_Anonymous_Access_Subprogram_Type)
then
-- From RM E.2.2(14), no anonymous access parameter other than
-- controlling ones may be used (because an anonymous access
......@@ -1454,9 +1454,9 @@ package body Sem_Cat is
("limited type not allowed in rci unit", Parent (E));
Explain_Limited_Type (E, Parent (E));
elsif Ekind (E) = E_Generic_Function
or else Ekind (E) = E_Generic_Package
or else Ekind (E) = E_Generic_Procedure
elsif Ekind_In (E, E_Generic_Function,
E_Generic_Package,
E_Generic_Procedure)
then
Error_Msg_N ("generic declaration not allowed in rci unit",
Parent (E));
......@@ -1551,7 +1551,6 @@ package body Sem_Cat is
Type_Decl := Parent (Param_Type);
if Ekind (Param_Type) = E_Anonymous_Access_Type then
if K = N_Subprogram_Declaration then
Error_Node := Param_Spec;
end if;
......
......@@ -3843,6 +3843,16 @@ package body Sem_Ch8 is
Error_Msg_NE ("\\missing `WITH &;`", N, Ent);
Error_Msg_Qual_Level := 0;
end if;
if Ekind (Ent) = E_Discriminant
and then Present (Corresponding_Discriminant (Ent))
and then Scope (Corresponding_Discriminant (Ent)) =
Etype (Scope (Ent))
then
Error_Msg_N
("inherited discriminant not allowed here" &
" (RM 3.8 (12), 3.8.1 (6))!", N);
end if;
end if;
-- Set entity and its containing package as referenced. We
......
......@@ -175,10 +175,7 @@ package body Sem_Disp is
Next_Formal (Formal);
end loop;
if Ekind (Subp) = E_Function
or else
Ekind (Subp) = E_Generic_Function
then
if Ekind_In (Subp, E_Function, E_Generic_Function) then
Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp);
if Present (Ctrl_Type) then
......@@ -673,7 +670,7 @@ package body Sem_Disp is
Body_Is_Last_Primitive : Boolean := False;
begin
if Ekind (Subp) /= E_Procedure and then Ekind (Subp) /= E_Function then
if not Ekind_In (Subp, E_Procedure, E_Function) then
return;
end if;
......@@ -1499,7 +1496,7 @@ package body Sem_Disp is
-- For subprograms internally generated by derivations of tagged types
-- use the alias subprogram as a reference to locate the dispatching
-- type of Subp
-- type of Subp.
elsif not Comes_From_Source (Subp)
and then Present (Alias (Subp))
......
......@@ -3013,10 +3013,7 @@ package body Sem_Elab is
-- Check for case of body entity
-- Why is the check for E_Void needed???
if Ekind (E) = E_Void
or else Ekind (E) = E_Subprogram_Body
or else Ekind (E) = E_Package_Body
then
if Ekind_In (E, E_Void, E_Subprogram_Body, E_Package_Body) then
Decl := E;
loop
......@@ -3047,17 +3044,17 @@ package body Sem_Elab is
if No (Corresponding_Body (N)) then
declare
Loc : constant Source_Ptr := Sloc (N);
B : Node_Id;
Formals : constant List_Id :=
Copy_Parameter_List (Ent);
Nam : constant Entity_Id :=
Make_Defining_Identifier (Loc, Chars (Ent));
Spec : Node_Id;
Stats : constant List_Id :=
New_List
(Make_Raise_Program_Error (Loc,
Reason => PE_Access_Before_Elaboration));
Loc : constant Source_Ptr := Sloc (N);
B : Node_Id;
Formals : constant List_Id := Copy_Parameter_List (Ent);
Nam : constant Entity_Id :=
Make_Defining_Identifier (Loc, Chars (Ent));
Spec : Node_Id;
Stats : constant List_Id :=
New_List
(Make_Raise_Program_Error (Loc,
Reason => PE_Access_Before_Elaboration));
begin
if Ekind (Ent) = E_Function then
Spec :=
......
......@@ -332,9 +332,8 @@ package body Sem_Elim is
-- Check for case of subprogram
elsif Ekind (E) = E_Function
or else Ekind (E) = E_Procedure
then
elsif Ekind_In (E, E_Function, E_Procedure) then
-- If Source_Location present, then see if it matches
if Elmt.Source_Location /= No_Name then
......
......@@ -4698,8 +4698,8 @@ package body Sem_Eval is
if Can_Never_Be_Null (T1) /= Can_Never_Be_Null (T2) then
return False;
elsif Ekind (T1) = E_Access_Subprogram_Type
or else Ekind (T1) = E_Anonymous_Access_Subprogram_Type
elsif Ekind_In (T1, E_Access_Subprogram_Type,
E_Anonymous_Access_Subprogram_Type)
then
return
Subtype_Conformant
......
......@@ -8984,13 +8984,10 @@ package body Sem_Res is
Set_Etype (N, Slice_Subtype);
-- In the packed case, this must be immediately frozen
-- Always freeze subtype. This ensures that the slice subtype is
-- elaborated in the scope of the expression.
Freeze_Itype (Slice_Subtype, N);
end Set_Slice_Subtype;
--------------------------------
......
......@@ -149,7 +149,6 @@ package body Sem_SCIL is
when others =>
pragma Assert (False);
null;
end case;
return Skip;
......@@ -484,7 +483,7 @@ package body Sem_SCIL is
then
return Found_Node;
-- In the subexpression case, keep climbing
-- In the subexpression case keep climbing
else
null;
......@@ -647,7 +646,7 @@ package body Sem_SCIL is
end case;
-- If we fall through above tests, keep climbing tree
-- If we fall through above tests keep climbing tree
if Nkind (Parent (P)) = N_Subunit then
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
-- Copyright (C) 2001-2010, 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- --
......@@ -23,9 +23,10 @@
-- --
------------------------------------------------------------------------------
with Debug; use Debug;
with Osint; use Osint;
with Opt; use Opt;
with Debug; use Debug;
with Osint; use Osint;
with Opt; use Opt;
with Output; use Output;
with System.WCh_Con; use System.WCh_Con;
......@@ -146,6 +147,8 @@ package body Switch.B is
Ada_Bind_File := False;
Write_Line ("warning: gnatbind switch -C is obsolescent");
-- Processing for d switch
when 'd' =>
......
......@@ -1100,6 +1100,7 @@ package body Switch.C is
Arg_Rank : Positive) return Boolean
is
use type System.Strings.String_Access;
begin
-- Loop through arguments following the current one
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment