aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/scng.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-03-19 17:41:25 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-03-19 17:41:25 +0100
commit2a1f6a1f9045969b4b04f3316a7f80969ff7c22b (patch)
tree9e8370f258615466dcb25746f2f0432ed0898d2c /gcc/ada/scng.adb
parent119e3be6ca8ad32ed4cb683a5d1f7ae0b7279a8a (diff)
downloadgcc-2a1f6a1f9045969b4b04f3316a7f80969ff7c22b.zip
gcc-2a1f6a1f9045969b4b04f3316a7f80969ff7c22b.tar.gz
gcc-2a1f6a1f9045969b4b04f3316a7f80969ff7c22b.tar.bz2
[multiple changes]
2012-03-19 Yannick Moy <moy@adacore.com> * sem_ch6.adb: Minor code clean up. 2012-03-19 Vincent Celier <celier@adacore.com> * make.adb (Scan_Make_Arg): Make sure all significant -m switches on the command line are counted. 2012-03-19 Robert Dewar <dewar@adacore.com> * sem_elab.adb (Generate_Elab_Warnings): Fix spec, fix attribute reference case 2012-03-19 Robert Dewar <dewar@adacore.com> * par-ch4.adb (Check_Bad_Exp): New procedure 2012-03-19 Robert Dewar <dewar@adacore.com> * exp_attr.adb, sem_attr.adb, sem_attr.ads, snames.ads-tmpl: Add initial framework for Valid_Scalars attribute. 2012-03-19 Robert Dewar <dewar@adacore.com> * scng.adb (Scan): Recognize incorrect preprocessor directive 2012-03-19 Robert Dewar <dewar@adacore.com> * atree.adb (Allocate_Initialize_Node): Use Num_Extension_Nodes * atree.ads (Num_Extension_Nodes): New variable * debug.adb: New debug flag -gnatd.N * gnat1drv.adb (Adjust_Global_Switches): Adjust Num_Extension_Nodes if -gnatd.N set 2012-03-19 Eric Botcazou <ebotcazou@adacore.com> * einfo.ads: Minor update to First_Rep_Item and Has_Gigi_Rep_Item descriptions. 2012-03-19 Robert Dewar <dewar@adacore.com> * opt.ads: Remove HLO_Active flag. * sem.adb: Remove call of high level optimizer. * sem.ads (New_Nodes_OK): Removed. * sem_ch10.adb: Remove references to New_Nodes_OK. * switch-c.adb: Remove handling of -gnatH switch. From-SVN: r185528
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r--gcc/ada/scng.adb67
1 files changed, 66 insertions, 1 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 2935bdb..b0a17db 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, 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- --
@@ -2242,6 +2242,71 @@ package body Scng is
Scan_Ptr := Scan_Ptr + 1;
return;
+ -- Check for something looking like a preprocessor directive
+
+ elsif Source (Scan_Ptr) = '#'
+ and then (Source (Scan_Ptr + 1 .. Scan_Ptr + 2) = "if"
+ or else
+ Source (Scan_Ptr + 1 .. Scan_Ptr + 5) = "elsif"
+ or else
+ Source (Scan_Ptr + 1 .. Scan_Ptr + 4) = "else"
+ or else
+ Source (Scan_Ptr + 1 .. Scan_Ptr + 3) = "end")
+ then
+ Error_Msg_S
+ ("preprocessor directive ignored, preprocessor not active");
+
+ -- Skip to end of line
+
+ loop
+ if Source (Scan_Ptr) in Graphic_Character
+ or else
+ Source (Scan_Ptr) = HT
+ then
+ Scan_Ptr := Scan_Ptr + 1;
+
+ -- Done if line terminator or EOF
+
+ elsif Source (Scan_Ptr) in Line_Terminator
+ or else
+ Source (Scan_Ptr) = EOF
+ then
+ exit;
+
+ -- If we have a wide character, we have to scan it out,
+ -- because it might be a legitimate line terminator
+
+ elsif Start_Of_Wide_Character then
+ declare
+ Wptr : constant Source_Ptr := Scan_Ptr;
+ Code : Char_Code;
+ Err : Boolean;
+
+ begin
+ Scan_Wide (Source, Scan_Ptr, Code, Err);
+
+ -- If not well formed wide character, then just skip
+ -- past it and ignore it.
+
+ if Err then
+ Scan_Ptr := Wptr + 1;
+
+ -- If UTF_32 terminator, terminate comment scan
+
+ elsif Is_UTF_32_Line_Terminator (UTF_32 (Code)) then
+ Scan_Ptr := Wptr;
+ exit;
+ end if;
+ end;
+
+ -- Else keep going (don't worry about bad comment chars
+ -- in this context, we just want to find the end of line.
+
+ else
+ Scan_Ptr := Scan_Ptr + 1;
+ end if;
+ end loop;
+
-- Otherwise, this is an illegal character
else