diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:45:25 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:45:25 +0000 |
commit | 9925603e39a1d02a6f0883d26e4eafb7f148eed0 (patch) | |
tree | 7f1f9f1c3411501de6576d01a74c4d83f635c7a1 /gcc/ada/scng.adb | |
parent | fcdc023a8715ff3e826cf73114712889e4319607 (diff) | |
download | gcc-9925603e39a1d02a6f0883d26e4eafb7f148eed0.tar.gz |
2007-08-14 Robert Dewar <dewar@adacore.com>
* s-intman-irix.adb, s-osinte-irix.adb, s-osinte-irix.ads,
s-proinf-irix-athread.ads, s-osinte-hpux-dce.adb, s-osinte-hpux-dce.ads,
s-parame-hpux.ads, s-intman-dummy.adb, s-tasinf-solaris.adb,
s-tasinf-solaris.ads, s-asthan-vms-alpha.adb, s-inmaop-vms.adb,
s-intman-vms.adb, s-intman-vms.ads, s-osprim-mingw.adb,
s-parame-vms-restrict.ads, s-parame-ae653.ads, s-intman-vxworks.ads,
s-intman-vxworks.ads, s-intman-vxworks.adb, s-parame-vxworks.ads,
s-tfsetr-vxworks.adb, s-interr.adb, s-interr.ads, a-tasatt.adb,
exp_ch13.adb, s-htable.ads, s-imgboo.ads, s-imglli.ads, s-imgllu.ads,
s-imguns.ads, g-eacodu.adb, par-ch12.adb, s-stache.ads, s-stausa.adb,
s-poosiz.adb, s-parame.ads, s-mastop.ads, s-osinte-darwin.ads,
a-chtgke.adb, s-asthan-vms-alpha.adb, s-parame-vms-alpha.ads,
s-parame-vms-ia64.ads, s-parame-vxworks.adb, s-except.ads,
g-altcon.adb: Minor reformatting
ada-tree.h: Delete empty line.
ali.ads: Minor reformatting
Clarification of comments.
Minor spelling correction
* exp_dbug.adb: Add Warnings Off to suppress new warning
* a-witeio.adb (Write): Add Warnings (Off) for unneeded IN OUT mode
formal
* a-strunb.adb (Set_Unbounded_String): Avoid memory leak by freeing old
value
* a-textio.adb (Write): Remove an unnecessary IN OUT mode from
* a-textio.ads: Reorder the standard input/output/error declarations
for consistency.
* g-dirope.adb, g-dirope.ads: Change Dir to mode IN for Open call
* par-ch2.adb: Recognize RM specially in errout
Change 'R'M to RM in all error messages
* scng.adb: Recognize RM specially in errout
* sem.ads, sem.adb, exp_strm.adb, exp_ch5.ads, expander.adb: Rename
N_Return node to be N_Simple_Return, to reflect Ada 2005 terminology.
* s-direio.adb: Add missing routine header box.
* sem_attr.ads: Add ??? comments
* sem_eval.adb: Recognize RM specially in errout
Change 'R'M to RM in all error messages
* sem_maps.adb, sem_maps.ads: Remove some unnecessary IN OUT modes
* s-tasinf.ads: Fix minor comment typo.
* a-cihama.adb: Minor comment addition
* a-ztexio.adb (Write): Add Warnings (Off) for unneeded IN OUT mode
formal
* s-tasinf-tru64.ads: Fix minor comment typo.
* itypes.ads: Comment update.
* ali-util.adb: Remove Generic_Separately_Compiled guard, not needed
anymore.
* argv.c: Added protection against null gnat_argv and gnat_envp.
* bcheck.adb (Check_Consistency): Use correct markup character ({) in
warning message when Tolerate_Consistency_Errors is True.
* cstand.adb (Create_Standard): Do not call Init_Size_Alignment for
Any_Id, as this subprogram is only applicable to *type* entities (it
sets RM_Size). Instead initialize just Esize and Alignment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127440 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r-- | gcc/ada/scng.adb | 161 |
1 files changed, 116 insertions, 45 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index e9a0e0284e1..fe23600ee28 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -571,7 +571,7 @@ package body Scng is if Warn_On_Obsolescent_Feature then Error_Msg_S - ("use of "":"" is an obsolescent feature ('R'M 'J.2(3))?"); + ("use of "":"" is an obsolescent feature (RM J.2(3))?"); Error_Msg_S ("\use ""'#"" instead?"); end if; @@ -1178,7 +1178,10 @@ package body Scng is -- Horizontal tab, just skip past it when HT => - if Style_Check then Style.Check_HT; end if; + if Style_Check then + Style.Check_HT; + end if; + Scan_Ptr := Scan_Ptr + 1; -- End of file character, treated as an end of file only if it is @@ -1187,7 +1190,11 @@ package body Scng is when EOF => if Scan_Ptr = Source_Last (Current_Source_File) then Check_End_Of_Line; - if Style_Check then Style.Check_EOF; end if; + + if Style_Check then + Style.Check_EOF; + end if; + Token := Tok_EOF; return; else @@ -1237,7 +1244,11 @@ package body Scng is if Double_Char_Token ('=') then Token := Tok_Colon_Equal; - if Style_Check then Style.Check_Colon_Equal; end if; + + if Style_Check then + Style.Check_Colon_Equal; + end if; + return; elsif Source (Scan_Ptr + 1) = '-' @@ -1251,7 +1262,11 @@ package body Scng is else Scan_Ptr := Scan_Ptr + 1; Token := Tok_Colon; - if Style_Check then Style.Check_Colon; end if; + + if Style_Check then + Style.Check_Colon; + end if; + return; end if; @@ -1261,7 +1276,11 @@ package body Scng is Accumulate_Checksum ('('); Scan_Ptr := Scan_Ptr + 1; Token := Tok_Left_Paren; - if Style_Check then Style.Check_Left_Paren; end if; + + if Style_Check then + Style.Check_Left_Paren; + end if; + return; -- Left bracket @@ -1291,7 +1310,11 @@ package body Scng is Accumulate_Checksum (','); Scan_Ptr := Scan_Ptr + 1; Token := Tok_Comma; - if Style_Check then Style.Check_Comma; end if; + + if Style_Check then + Style.Check_Comma; + end if; + return; -- Dot, which is either an isolated period, or part of a double dot @@ -1303,7 +1326,11 @@ package body Scng is if Double_Char_Token ('.') then Token := Tok_Dot_Dot; - if Style_Check then Style.Check_Dot_Dot; end if; + + if Style_Check then + Style.Check_Dot_Dot; + end if; + return; elsif Source (Scan_Ptr + 1) in '0' .. '9' then @@ -1324,7 +1351,11 @@ package body Scng is if Double_Char_Token ('>') then Token := Tok_Arrow; - if Style_Check then Style.Check_Arrow; end if; + + if Style_Check then + Style.Check_Arrow; + end if; + return; elsif Source (Scan_Ptr + 1) = '=' then @@ -1369,7 +1400,11 @@ package body Scng is elsif Double_Char_Token ('>') then Token := Tok_Box; - if Style_Check then Style.Check_Box; end if; + + if Style_Check then + Style.Check_Box; + end if; + return; elsif Double_Char_Token ('<') then @@ -1401,7 +1436,10 @@ package body Scng is -- Comment else -- Source (Scan_Ptr + 1) = '-' then - if Style_Check then Style.Check_Comment; end if; + if Style_Check then + Style.Check_Comment; + end if; + Scan_Ptr := Scan_Ptr + 2; -- If we are in preprocessor mode with Replace_In_Comments set, @@ -1447,7 +1485,10 @@ package body Scng is -- Keep going if horizontal tab if Source (Scan_Ptr) = HT then - if Style_Check then Style.Check_HT; end if; + if Style_Check then + Style.Check_HT; + end if; + Scan_Ptr := Scan_Ptr + 1; -- Terminate scan of comment if line terminator @@ -1538,7 +1579,7 @@ package body Scng is if Warn_On_Obsolescent_Feature then Error_Msg_S - ("use of ""'%"" is an obsolescent feature ('R'M 'J.2(4))?"); + ("use of ""'%"" is an obsolescent feature (RM J.2(4))?"); Error_Msg_S ("\use """""" instead?"); end if; @@ -1581,7 +1622,11 @@ package body Scng is or else Prev_Token in Token_Class_Literal then Token := Tok_Apostrophe; - if Style_Check then Style.Check_Apostrophe; end if; + + if Style_Check then + Style.Check_Apostrophe; + end if; + return; -- Otherwise the apostrophe starts a character literal @@ -1686,7 +1731,11 @@ package body Scng is Accumulate_Checksum (')'); Scan_Ptr := Scan_Ptr + 1; Token := Tok_Right_Paren; - if Style_Check then Style.Check_Right_Paren; end if; + + if Style_Check then + Style.Check_Right_Paren; + end if; + return; -- Right bracket or right brace, treated as right paren @@ -1717,7 +1766,11 @@ package body Scng is Accumulate_Checksum (';'); Scan_Ptr := Scan_Ptr + 1; Token := Tok_Semicolon; - if Style_Check then Style.Check_Semicolon; end if; + + if Style_Check then + Style.Check_Semicolon; + end if; + return; -- Vertical bar @@ -1736,7 +1789,11 @@ package body Scng is else Scan_Ptr := Scan_Ptr + 1; Token := Tok_Vertical_Bar; - if Style_Check then Style.Check_Vertical_Bar; end if; + + if Style_Check then + Style.Check_Vertical_Bar; + end if; + return; end if; end Vertical_Bar_Case; @@ -1749,7 +1806,7 @@ package body Scng is if Warn_On_Obsolescent_Feature then Error_Msg_S - ("use of ""'!"" is an obsolescent feature ('R'M 'J.2(2))?"); + ("use of ""'!"" is an obsolescent feature (RM J.2(2))?"); Error_Msg_S ("\use ""'|"" instead?"); end if; @@ -2321,32 +2378,43 @@ package body Scng is if Is_Keyword_Name (Token_Name) then Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name)); - -- Deal with possible style check for non-lower case keyword, but - -- we don't treat ACCESS, DELTA, DIGITS, RANGE as keywords for - -- this purpose if they appear as attribute designators. Actually - -- we only check the first character for speed. - - -- Ada 2005 (AI-284): Do not apply the style check in case of - -- "pragma Interface" - - -- Ada 2005 (AI-340): Do not apply the style check in case of - -- MOD attribute. - - if Style_Check - and then Source (Token_Ptr) <= 'Z' - and then (Prev_Token /= Tok_Apostrophe - or else - (Token /= Tok_Access and then - Token /= Tok_Delta and then - Token /= Tok_Digits and then - Token /= Tok_Mod and then - Token /= Tok_Range)) - and then (Token /= Tok_Interface - or else - (Token = Tok_Interface - and then Prev_Token /= Tok_Pragma)) - then - Style.Non_Lower_Case_Keyword; + -- Keyword style checks + + if Style_Check then + + -- Deal with possible style check for non-lower case keyword, + -- but we don't treat ACCESS, DELTA, DIGITS, RANGE as keywords + -- for this purpose if they appear as attribute designators. + -- Actually we only check the first character for speed. + + -- Ada 2005 (AI-284): Do not apply the style check in case of + -- "pragma Interface" + + -- Ada 2005 (AI-340): Do not apply the style check in case of + -- MOD attribute. + + if Source (Token_Ptr) <= 'Z' + and then (Prev_Token /= Tok_Apostrophe + or else + (Token /= Tok_Access and then + Token /= Tok_Delta and then + Token /= Tok_Digits and then + Token /= Tok_Mod and then + Token /= Tok_Range)) + and then (Token /= Tok_Interface + or else + (Token = Tok_Interface + and then Prev_Token /= Tok_Pragma)) + then + Style.Non_Lower_Case_Keyword; + end if; + + if (Token = Tok_Then and then Prev_Token /= Tok_And) + or else + (Token = Tok_Else and then Prev_Token /= Tok_Or) + then + Style.Check_Separate_Stmt_Lines; + end if; end if; -- We must reset Token_Name since this is not an identifier and @@ -2470,7 +2538,10 @@ package body Scng is -- Outer loop keeps going only if a horizontal tab follows if Source (Scan_Ptr) = HT then - if Style_Check then Style.Check_HT; end if; + if Style_Check then + Style.Check_HT; + end if; + Scan_Ptr := Scan_Ptr + 1; Start_Column := (Start_Column / 8) * 8 + 8; else |