aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorViljar Indus <indus@adacore.com>2024-06-21 13:28:40 +0300
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-08-29 15:06:27 +0200
commitf872bba253c0edf55436c77f8d3edd881e7bdaba (patch)
treeb9dfb08f7bbeace30379e5c51cf6e71299dc92ec /gcc
parent446f415e44fc0d5f4caeb182ecabf73329d5b049 (diff)
downloadgcc-f872bba253c0edf55436c77f8d3edd881e7bdaba.zip
gcc-f872bba253c0edf55436c77f8d3edd881e7bdaba.tar.gz
gcc-f872bba253c0edf55436c77f8d3edd881e7bdaba.tar.bz2
ada: Parse the attributes of continuation messages correctly
Currently unless pretty printing is enabled we avoid parsing the message strings for continuation messages. This leads to inconsistent state for the Error_Msg_Object-s that are being created. gcc/ada/ * erroutc.adb (Prescan_Message): Avoid not parsing all of the message attributes. * erroutc.ads: Update the documentation.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/erroutc.adb27
-rw-r--r--gcc/ada/erroutc.ads3
2 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index 2ce3505..4e0a9f2 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -922,15 +922,36 @@ package body Erroutc is
-- Start of processing for Prescan_Message
begin
- -- Nothing to do for continuation line, unless -gnatdF is set
+ -- Continuation lines need to check only for insertion sequences.
+ -- Other attributes should be inherited from the main message.
+
+ if Msg (Msg'First) = '\' then
+ Has_Insertion_Line := False;
+
+ J := Msg'First;
+
+ -- If we have a quote, don't look at following character
+
+ while J <= Msg'Last loop
+ if Msg (J) = ''' then
+ J := J + 2;
+
+ -- Insertion line (# insertion)
+
+ elsif Msg (J) = '#' then
+ Has_Insertion_Line := True;
+ J := J + 1;
+ else
+ J := J + 1;
+ end if;
+ end loop;
- if not Debug_Flag_FF and then Msg (Msg'First) = '\' then
return;
-- Some global variables are not set for continuation messages, as they
-- only make sense for the initial message.
- elsif Msg (Msg'First) /= '\' then
+ else
-- Set initial values of globals (may be changed during scan)
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index effc667..0a52af5 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -555,8 +555,7 @@ package Erroutc is
-- test these values before doing the full error scan.
--
-- Note that the call has no effect for continuation messages (those whose
- -- first character is '\'), and all variables are left unchanged, unless
- -- -gnatdF is set.
+ -- first character is '\') except for the Has_Insertion_Line setting.
procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr);
-- All error messages whose location is in the range From .. To (not