public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix continuation message without a prior error
@ 2022-05-19 14:16 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-19 14:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

When resolution of an expanded name fails, we call routine
Error_Missing_With_Of_Known_Unit which emits an error continuation
message (i.e. an error string starting with \\). However, for error
continuations to work properly there must be some prior error, because
continuation itself doesn't set flags like Serious_Errors_Detected.

Without these flags the problematic statement is not marked with
Error_Posted, which in turn is needed to prevent cascaded errors.

In particular, when unresolved procedure call uses a direct name or an
extended name with an unknown prefix, e.g.:

  Unknown (1, 2, 3);
  Unknown.Call (1, 2, 3);

then the N_Procedure_Call statements are marked with Error_Posted. But
when a call uses an extended name with a known prefix we failed to flag
the N_Procedure_Call with Error_Posted.

Found while improving the robustness of a feature that detects
uninitialized scalar objects.

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

gcc/ada/

	* sem_ch8.adb (Find_Expanded_Name): Emit a main error message
	before adding a continuation with the call to
	Error_Missing_With_Of_Known_Unit.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 501 bytes --]

diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6995,6 +6995,8 @@ package body Sem_Ch8 is
                                            Standard_Standard)
                then
                   if not Error_Posted (N) then
+                     Error_Msg_NE
+                       ("& is not a visible entity of&", Prefix (N), Selector);
                      Error_Missing_With_Of_Known_Unit (Prefix (N));
                   end if;
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-19 14:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 14:16 [Ada] Fix continuation message without a prior error Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).