Commit a2773bd3 by Arnaud Charlet

[multiple changes]

2011-08-05  Thomas Quinot  <quinot@adacore.com>

	* sem_ch11.adb: Add comment.

2011-08-05  Robert Dewar  <dewar@adacore.com>

	* exp_util.adb: Minor comment fix.

2011-08-05  Robert Dewar  <dewar@adacore.com>

	* scng.adb (Error_Unterminated_String): Improve flag position when
	comma present.

2011-08-05  Matthew Heaney  <heaney@adacore.com>

	* Makefile.rtl, impunit.adb: Added a-cbmutr.ad[sb] (bounded multiway
	tree containers).
	* a-cbmutr.ads, a-cbmutr.adb: This is the new Ada 2012 unit for bounded
	multiway tree containers.

2011-08-05  Robert Dewar  <dewar@adacore.com>

	* styleg.adb (Check_Comment): Implement comment spacing of 1 or 2
	* stylesw.adb: Implement -gnatyC to control comment spacing
	* stylesw.ads (Style_Check_Comments_Spacing): New switch (set by
	-gnatyc/C).
	* usage.adb: Add line for -gnatyC.

2011-08-05  Robert Dewar  <dewar@adacore.com>

	* gnat_ugn.texi: Document -gnatyC for J505-006
	* vms_data.ads: Implement COMMENTS1/COMMENTS2 (retaining COMMENTS as a
	synonym for COMMENTS2).

From-SVN: r177453
parent aca0b0b3
2011-08-05 Thomas Quinot <quinot@adacore.com>
* sem_ch11.adb: Add comment.
2011-08-05 Robert Dewar <dewar@adacore.com>
* exp_util.adb: Minor comment fix.
2011-08-05 Robert Dewar <dewar@adacore.com>
* scng.adb (Error_Unterminated_String): Improve flag position when
comma present.
2011-08-05 Matthew Heaney <heaney@adacore.com>
* Makefile.rtl, impunit.adb: Added a-cbmutr.ad[sb] (bounded multiway
tree containers).
* a-cbmutr.ads, a-cbmutr.adb: This is the new Ada 2012 unit for bounded
multiway tree containers.
2011-08-05 Robert Dewar <dewar@adacore.com>
* styleg.adb (Check_Comment): Implement comment spacing of 1 or 2
* stylesw.adb: Implement -gnatyC to control comment spacing
* stylesw.ads (Style_Check_Comments_Spacing): New switch (set by
-gnatyc/C).
* usage.adb: Add line for -gnatyC.
2011-08-05 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Document -gnatyC for J505-006
* vms_data.ads: Implement COMMENTS1/COMMENTS2 (retaining COMMENTS as a
synonym for COMMENTS2).
2011-08-05 Robert Dewar <dewar@adacore.com> 2011-08-05 Robert Dewar <dewar@adacore.com>
* par_sco.adb, sem_ch3.adb, scos.ads, a-iteint.ads, sem_ch12.adb, * par_sco.adb, sem_ch3.adb, scos.ads, a-iteint.ads, sem_ch12.adb,
......
...@@ -90,6 +90,7 @@ GNATRTL_NONTASKING_OBJS= \ ...@@ -90,6 +90,7 @@ GNATRTL_NONTASKING_OBJS= \
a-cbhase$(objext) \ a-cbhase$(objext) \
a-cborse$(objext) \ a-cborse$(objext) \
a-cbdlli$(objext) \ a-cbdlli$(objext) \
a-cbmutr$(objext) \
a-cborma$(objext) \ a-cborma$(objext) \
a-cdlili$(objext) \ a-cdlili$(objext) \
a-cfdlli$(objext) \ a-cfdlli$(objext) \
......
...@@ -176,14 +176,8 @@ package body Exp_Util is ...@@ -176,14 +176,8 @@ package body Exp_Util is
Ti : Entity_Id; Ti : Entity_Id;
begin begin
-- For now, we simply ignore a call where the argument has no type -- Defend against a call where the argument has no type, or has a
-- (probably case of unanalyzed condition), or has a type that is not -- type that is not Boolean. This can occur because of prior errors.
-- Boolean. This is because this is a pretty marginal piece of
-- functionality, and violations of these rules are likely to be
-- truly marginal (how much code uses Fortran Logical as the barrier
-- to a protected entry?) and we do not want to blow up existing
-- programs. We can change this to an assertion after 3.12a is
-- released ???
if No (T) or else not Is_Boolean_Type (T) then if No (T) or else not Is_Boolean_Type (T) then
return; return;
......
...@@ -6258,8 +6258,8 @@ The use of AND/OR operators is not permitted except in the cases of modular ...@@ -6258,8 +6258,8 @@ The use of AND/OR operators is not permitted except in the cases of modular
operands, array operands, and simple stand-alone boolean variables or operands, array operands, and simple stand-alone boolean variables or
boolean constants. In all other cases AND THEN/OR ELSE are required. boolean constants. In all other cases AND THEN/OR ELSE are required.
@item ^c^COMMENTS^ @item ^c^COMMENTS^ (double space)
@emph{Check comments.} @emph{Check comments, double space.}
Comments must meet the following set of rules: Comments must meet the following set of rules:
@itemize @bullet @itemize @bullet
...@@ -6310,6 +6310,11 @@ example: ...@@ -6310,6 +6310,11 @@ example:
@end smallexample @end smallexample
@end itemize @end itemize
@item ^C^COMMENTS1^ (single space)
@emph{Check comments, single space.}
This is identical to @code{^c^COMMENTS} except that only one space
is required following the @code{--} of a comment instead of two.
@item ^d^DOS_LINE_ENDINGS^ @item ^d^DOS_LINE_ENDINGS^
@emph{Check no DOS line terminators present.} @emph{Check no DOS line terminators present.}
All lines must be terminated by a single ASCII.LF All lines must be terminated by a single ASCII.LF
......
...@@ -517,6 +517,7 @@ package body Impunit is ...@@ -517,6 +517,7 @@ package body Impunit is
"a-coinho", -- Ada.Containers.Indefinite_Holders "a-coinho", -- Ada.Containers.Indefinite_Holders
"a-comutr", -- Ada.Containers.Multiway_Trees "a-comutr", -- Ada.Containers.Multiway_Trees
"a-cimutr", -- Ada.Containers.Indefinite_Multiway_Trees "a-cimutr", -- Ada.Containers.Indefinite_Multiway_Trees
"a-cbmutr", -- Ada.Containers.Bounded_Multiway_Trees
"a-extiin", -- Ada.Execution_Time.Interrupts "a-extiin", -- Ada.Execution_Time.Interrupts
"a-iteint", -- Ada.Iterator_Interfaces "a-iteint", -- Ada.Iterator_Interfaces
......
...@@ -919,6 +919,9 @@ package body Scng is ...@@ -919,6 +919,9 @@ package body Scng is
Err : Boolean; Err : Boolean;
-- Error flag for Scan_Wide call -- Error flag for Scan_Wide call
String_Start : Source_Ptr;
-- Point to first character of string
procedure Error_Bad_String_Char; procedure Error_Bad_String_Char;
-- Signal bad character in string/character literal. On entry -- Signal bad character in string/character literal. On entry
-- Scan_Ptr points to the improper character encountered during the -- Scan_Ptr points to the improper character encountered during the
...@@ -966,6 +969,8 @@ package body Scng is ...@@ -966,6 +969,8 @@ package body Scng is
------------------------------- -------------------------------
procedure Error_Unterminated_String is procedure Error_Unterminated_String is
S : Source_Ptr;
begin begin
-- An interesting little refinement. Consider the following -- An interesting little refinement. Consider the following
-- examples: -- examples:
...@@ -973,6 +978,7 @@ package body Scng is ...@@ -973,6 +978,7 @@ package body Scng is
-- A := "this is an unterminated string; -- A := "this is an unterminated string;
-- A := "this is an unterminated string & -- A := "this is an unterminated string &
-- P(A, "this is a parameter that didn't get terminated); -- P(A, "this is a parameter that didn't get terminated);
-- P("this is a parameter that didn't get terminated, A);
-- We fiddle a little to do slightly better placement in these -- We fiddle a little to do slightly better placement in these
-- cases also if there is white space at the end of the line we -- cases also if there is white space at the end of the line we
...@@ -1012,6 +1018,8 @@ package body Scng is ...@@ -1012,6 +1018,8 @@ package body Scng is
return; return;
end if; end if;
-- Backup over semicolon or right-paren/semicolon sequence
if Source (Scan_Ptr - 1) = ';' then if Source (Scan_Ptr - 1) = ';' then
Scan_Ptr := Scan_Ptr - 1; Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char; Unstore_String_Char;
...@@ -1022,6 +1030,25 @@ package body Scng is ...@@ -1022,6 +1030,25 @@ package body Scng is
end if; end if;
end if; end if;
-- See if there is a comma in the string, if so, guess that
-- the first comma terminates the string.
S := String_Start;
while S < Scan_Ptr loop
if Source (S) = ',' then
while Scan_Ptr > S loop
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
end loop;
exit;
end if;
S := S + 1;
end loop;
-- Now we have adjusted the scan pointer, give message
Error_Msg_S -- CODEFIX Error_Msg_S -- CODEFIX
("missing string quote"); ("missing string quote");
end Error_Unterminated_String; end Error_Unterminated_String;
...@@ -1161,6 +1188,8 @@ package body Scng is ...@@ -1161,6 +1188,8 @@ package body Scng is
-- quote). The latter case is an error detected by the character -- quote). The latter case is an error detected by the character
-- literal circuit. -- literal circuit.
String_Start := Scan_Ptr;
Delimiter := Source (Scan_Ptr); Delimiter := Source (Scan_Ptr);
Accumulate_Checksum (Delimiter); Accumulate_Checksum (Delimiter);
......
...@@ -481,7 +481,10 @@ package body Sem_Ch11 is ...@@ -481,7 +481,10 @@ package body Sem_Ch11 is
-- handler, since this may result in false positives, since -- handler, since this may result in false positives, since
-- the handler may handle the exception and return normally. -- the handler may handle the exception and return normally.
-- First find enclosing sequence of statements -- First find the enclosing handled sequence of statements
-- (note, we could also look for a handler in an outer block
-- but currently we don't, and in that case we'll emit the
-- warning).
Par := N; Par := N;
loop loop
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -507,7 +507,9 @@ package body Styleg is ...@@ -507,7 +507,9 @@ package body Styleg is
S := Scan_Ptr + 2; S := Scan_Ptr + 2;
while Source (S) >= ' ' loop while Source (S) >= ' ' loop
if Source (S) /= '-' then if Source (S) /= '-' then
if Is_Box_Comment then if Is_Box_Comment
or else Style_Check_Comments_Spacing = 1
then
Error_Space_Required (Scan_Ptr + 2); Error_Space_Required (Scan_Ptr + 2);
else else
Error_Msg -- CODEFIX Error_Msg -- CODEFIX
...@@ -522,14 +524,17 @@ package body Styleg is ...@@ -522,14 +524,17 @@ package body Styleg is
-- If we are followed by a blank, then the comment is OK if the -- If we are followed by a blank, then the comment is OK if the
-- character following this blank is another blank or a format -- character following this blank is another blank or a format
-- effector. -- effector, or if the required comment spacing is 1.
elsif Source (Scan_Ptr + 3) <= ' ' then elsif Source (Scan_Ptr + 3) <= ' '
or else Style_Check_Comments_Spacing = 1
then
return; return;
-- Here is the case where we only have one blank after the two -- Here is the case where we only have one blank after the two minus
-- minus signs, which is an error unless the line ends with two -- signs, with Style_Check_Comments_Spacing set to 2, which is an
-- minus signs, the case of a box comment. -- error unless the line ends with two minus signs, the case of a
-- box comment.
elsif not Is_Box_Comment then elsif not Is_Box_Comment then
Error_Space_Required (Scan_Ptr + 3); Error_Space_Required (Scan_Ptr + 3);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -160,7 +160,13 @@ package body Stylesw is ...@@ -160,7 +160,13 @@ package body Stylesw is
Add ('A', Style_Check_Array_Attribute_Index); Add ('A', Style_Check_Array_Attribute_Index);
Add ('b', Style_Check_Blanks_At_End); Add ('b', Style_Check_Blanks_At_End);
Add ('B', Style_Check_Boolean_And_Or); Add ('B', Style_Check_Boolean_And_Or);
Add ('c', Style_Check_Comments);
if Style_Check_Comments_Spacing = 2 then
Add ('c', Style_Check_Comments);
elsif Style_Check_Comments_Spacing = 1 then
Add ('C', Style_Check_Comments);
end if;
Add ('d', Style_Check_DOS_Line_Terminator); Add ('d', Style_Check_DOS_Line_Terminator);
Add ('e', Style_Check_End_Labels); Add ('e', Style_Check_End_Labels);
Add ('f', Style_Check_Form_Feeds); Add ('f', Style_Check_Form_Feeds);
...@@ -322,6 +328,11 @@ package body Stylesw is ...@@ -322,6 +328,11 @@ package body Stylesw is
when 'c' => when 'c' =>
Style_Check_Comments := True; Style_Check_Comments := True;
Style_Check_Comments_Spacing := 2;
when 'C' =>
Style_Check_Comments := True;
Style_Check_Comments_Spacing := 1;
when 'd' => when 'd' =>
Style_Check_DOS_Line_Terminator := True; Style_Check_DOS_Line_Terminator := True;
...@@ -484,7 +495,7 @@ package body Stylesw is ...@@ -484,7 +495,7 @@ package body Stylesw is
when 'B' => when 'B' =>
Style_Check_Boolean_And_Or := False; Style_Check_Boolean_And_Or := False;
when 'c' => when 'c' | 'C' =>
Style_Check_Comments := False; Style_Check_Comments := False;
when 'd' => when 'd' =>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -94,7 +94,8 @@ package Stylesw is ...@@ -94,7 +94,8 @@ package Stylesw is
-- The comment characters are followed by an exclamation point (the -- The comment characters are followed by an exclamation point (the
-- sequence --! is used by gnatprep for marking deleted lines). -- sequence --! is used by gnatprep for marking deleted lines).
-- --
-- The comment characters are followed by two space characters -- The comment characters are followed by two space characters if
-- Comment_Spacing = 2, else by one character if Comment_Spacing = 1.
-- --
-- The line consists entirely of minus signs -- The line consists entirely of minus signs
-- --
...@@ -104,6 +105,9 @@ package Stylesw is ...@@ -104,6 +105,9 @@ package Stylesw is
-- Note: the reason for the last two conditions is to allow "boxed" -- Note: the reason for the last two conditions is to allow "boxed"
-- comments where only a single space separates the comment characters. -- comments where only a single space separates the comment characters.
Style_Check_Comments_Spacing : Nat range 1 .. 2;
-- Spacing required for comments, valid only if Style_Check_Comments true.
Style_Check_DOS_Line_Terminator : Boolean := False; Style_Check_DOS_Line_Terminator : Boolean := False;
-- This can be set true by using the -gnatyd switch. If it is True, then -- This can be set true by using the -gnatyd switch. If it is True, then
-- the line terminator must be a single LF, without an associated CR (e.g. -- the line terminator must be a single LF, without an associated CR (e.g.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -548,7 +548,8 @@ begin ...@@ -548,7 +548,8 @@ begin
Write_Line (" A check array attribute indexes"); Write_Line (" A check array attribute indexes");
Write_Line (" b check no blanks at end of lines"); Write_Line (" b check no blanks at end of lines");
Write_Line (" B check no use of AND/OR for boolean expressions"); Write_Line (" B check no use of AND/OR for boolean expressions");
Write_Line (" c check comment format"); Write_Line (" c check comment format (two spaces)");
Write_Line (" C check comment format (one space)");
Write_Line (" d check no DOS line terminators"); Write_Line (" d check no DOS line terminators");
Write_Line (" e check end/exit labels present"); Write_Line (" e check end/exit labels present");
Write_Line (" f check no form feeds/vertical tabs in source"); Write_Line (" f check no form feeds/vertical tabs in source");
......
...@@ -2319,6 +2319,10 @@ package VMS_Data is ...@@ -2319,6 +2319,10 @@ package VMS_Data is
"-gnaty-B " & "-gnaty-B " &
"COMMENTS " & "COMMENTS " &
"-gnatyc " & "-gnatyc " &
"COMMENTS1 " &
"-gnatyC " &
"COMMENTS2 " &
"-gnatyc " &
"NOCOMMENTS " & "NOCOMMENTS " &
"-gnaty-c " & "-gnaty-c " &
"DOS_LINE_ENDINGS " & "DOS_LINE_ENDINGS " &
...@@ -2409,7 +2413,7 @@ package VMS_Data is ...@@ -2409,7 +2413,7 @@ package VMS_Data is
-- input source code. The following keywords are supported: -- input source code. The following keywords are supported:
-- --
-- ALL_BUILTIN (D) Equivalent to the following list of options: -- ALL_BUILTIN (D) Equivalent to the following list of options:
-- 3, ATTRIBUTE, BLANKS, COMMENTS, END, VTABS, -- 3, ATTRIBUTE, BLANKS, COMMENTS2, END, VTABS,
-- HTABS, IF_THEN, KEYWORD, LAYOUT, LINE_LENGTH, -- HTABS, IF_THEN, KEYWORD, LAYOUT, LINE_LENGTH,
-- PRAGMA, REFERENCES, SPECS, TOKEN. -- PRAGMA, REFERENCES, SPECS, TOKEN.
-- --
...@@ -2441,8 +2445,8 @@ package VMS_Data is ...@@ -2441,8 +2445,8 @@ package VMS_Data is
-- enforce a canonical format for the use of -- enforce a canonical format for the use of
-- blanks to separate source tokens. -- blanks to separate source tokens.
-- --
-- COMMENTS Check comments. -- COMMENTS2 Check comments.
-- Comments must meet the following set of rules: -- COMMENTS Comments must meet the following set of rules:
-- --
-- * The "--" that starts the column must either -- * The "--" that starts the column must either
-- start in column one, or else at least one -- start in column one, or else at least one
...@@ -2488,6 +2492,11 @@ package VMS_Data is ...@@ -2488,6 +2492,11 @@ package VMS_Data is
-- -- This is a box comment -- -- -- This is a box comment --
-- --------------------------- -- ---------------------------
-- --
-- COMMENTS1 Check comments (single space).
-- Like COMMENTS2, but the -- of a comment only
-- requires one or more spaces following, instead
-- of two or more spaces.
--
-- DOS_LINE_ENDINGS Check that no DOS line terminators are present -- DOS_LINE_ENDINGS Check that no DOS line terminators are present
-- All lines must be terminated by a single -- All lines must be terminated by a single
-- ASCII.LF character. In particular the DOS line -- ASCII.LF character. In particular the DOS line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment