This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Error handling consistency for named associations


An error occurring in a subexpression that is part of some construct in
general suppresses the reporting of further errors on the same construct,
to avoid noisy cascaded messages. This patch ensures that this is also
the case when named associations are present.

The following test case must be rejected with the indicated errors only
(note no additional message in the case where a named discriminant
association is used).

$ gcc -c bogus_constraint.ads
bogus_constraint.ads:9:21: "Cst1" is not visible
bogus_constraint.ads:9:21: non-visible declaration at line 3
bogus_constraint.ads:10:30: "Cst2" is not visible
bogus_constraint.ads:10:30: non-visible declaration at line 4

package Bogus_Constraint is
   package P is
      Cst1 : constant Integer := 1;
      Cst2 : constant Integer := 2;
   end P;

   type R (Start, Endx : Integer) is null record;

   subtype R1 is R (Cst1);
   subtype R2 is R (Start => Cst2);
end Bogus_Constraint;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-07-29  Thomas Quinot  <quinot@adacore.com>

	* errout.adb (Set_Error_Posted): When propagating flag to
	an enclosing named association, also propagate to the parent
	of that node, so that named and positional associations are
	treated consistently.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]