Eric Botcazou c743425fce [Ada] Fix spurious -Wuninitialized warnings for small records
This change is aimed at getting rid of spurious -Wuninitialized warnings
issued for small records passed by copy and containing default values
for some of their components.

The source of the problem is that the _Init parameter of the
initialization routine is declared as an in/out parameter, so the
uninitialized object is passed by copy to it and this can be flagged by
-Wuninitialized.

That's why the mode of the parameter is changed to out, except for the
cases where information really needs to be passed in: unconstrained
array types, protected and task types.

For the following record type Rec!

 type Rec is record
    B : Boolean := True;
  end record;

the initialization routine must now be:

      procedure r__recIP (_init : out r__rec1) is
      begin
         _init.b := true;
         return;
      end r__recIP;

2018-10-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch3.adb (Is_Null_Statement_List): New predicate.
	(Build_Array_Init_Proc): Use it to find out whether the
	initialization procedure Is_Null_Init_Proc; if so, set
	Warnings_Off on the parameter.
	(Build_Init_Procedure): Likewise.
	(Init_Formals): Use an in/out first parameter only for
	unconstrained arrays and for records either containing or built
	for proteced types or task types; use an out parameter in all
	the other cases.
	* fe.h (Is_Init_Proc): Declare.
	* gcc-interface/decl.c (type_requires_init_of_formal): Do not
	return true for a discriminant in an unchecked union.
	(gnat_to_gnu_param): Do not create a PARM_DECL for the Out
	parameter of an initialization procedure.

From-SVN: r264984
2018-10-09 15:06:55 +00:00
2018-10-08 14:21:30 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%