+2014-02-06 Sergey Rybin <rybin@adacore.com frybin>
+
+ * gnat_ugn.texi, vms_data.ads: Add documentation of -j option for
+ gnatmetric.
+
+2014-02-06 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Shift_Left): Handle shift counts greater
+ than the word size when operating in Modify_Tree_For_C mode.
+ * sinfo.ads: Add documentation section on Modify_Tree_For_C mode.
+
+2014-02-06 Robert Dewar <dewar@adacore.com>
+
+ * erroutc.adb (Warning_Specifically_Suppressed.Matches):
+ compare is case insensitive.
+ * gnat_rm.texi: Document that string compare for Warnings Off
+ is now case insensitive.
+
2014-02-06 Eric Botcazou <ebotcazou@adacore.com>
* gnat_rm.texi: Small wording tweak.
function Matches (S : String; P : String) return Boolean;
-- Returns true if the String S patches the pattern P, which can contain
-- wild card chars (*). The entire pattern must match the entire string.
+ -- Case is ignored in the comparison (so X matches x).
-------------
-- Matches --
-- Dealt with end of string and *, advance if we have a match
- elsif S (SPtr) = P (PPtr) then
+ elsif Fold_Lower (S (SPtr)) = Fold_Lower (P (PPtr)) then
SPtr := SPtr + 1;
PPtr := PPtr + 1;
Make_Op_Shift_Left (Loc,
Left_Opnd => Left_Opnd (N),
Right_Opnd => Right_Opnd (N)),
+
Right_Opnd =>
Make_Op_Shift_Right (Loc,
Left_Opnd => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
Make_Op_Shift_Right (Loc,
Left_Opnd => Left_Opnd (N),
Right_Opnd => Right_Opnd (N)),
+
Right_Opnd =>
Make_Op_Shift_Left (Loc,
Left_Opnd => Duplicate_Subexpr_No_Checks (Left_Opnd (N)),
-- Expand_N_Op_Shift_Left --
----------------------------
+ -- Note: nothing in this routine depends on left as opposed to right shifts
+ -- so we share the routine for expanding shift right operations.
+
procedure Expand_N_Op_Shift_Left (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
+
+ -- If we are in Modify_Tree_For_C mode, then ensure that the right
+ -- operand is not greater than the word size (since that would not
+ -- be defined properly by the corresponding C shift operator).
+
+ if Modify_Tree_For_C then
+ declare
+ Right : constant Node_Id := Right_Opnd (N);
+ Loc : constant Source_Ptr := Sloc (Right);
+ Typ : constant Entity_Id := Etype (N);
+ Siz : constant Uint := Esize (Typ);
+ Orig : Node_Id;
+ OK : Boolean;
+ Lo : Uint;
+ Hi : Uint;
+
+ begin
+ if Compile_Time_Known_Value (Right) then
+ if Expr_Value (Right) >= Siz then
+ Rewrite (N, Make_Integer_Literal (Loc, 0));
+ Analyze_And_Resolve (N, Typ);
+ end if;
+
+ -- Not compile time known, find range
+
+ else
+ Determine_Range (Right, OK, Lo, Hi, Assume_Valid => True);
+
+ -- Nothing to do if known to be OK range, otherwise expand
+
+ if not OK or else Hi >= Siz then
+
+ -- Prevent recursion on copy of shift node
+
+ Orig := Relocate_Node (N);
+ Set_Analyzed (Orig);
+
+ -- Now do the rewrite
+
+ Rewrite (N,
+ Make_If_Expression (Loc,
+ Expressions => New_List (
+ Make_Op_Ge (Loc,
+ Left_Opnd => Duplicate_Subexpr_Move_Checks (Right),
+ Right_Opnd => Make_Integer_Literal (Loc, Siz)),
+ Make_Integer_Literal (Loc, 0),
+ Orig)));
+ Analyze_And_Resolve (N, Typ);
+ end if;
+ end if;
+ end;
+ end if;
end Expand_N_Op_Shift_Left;
-----------------------------
procedure Expand_N_Op_Shift_Right (N : Node_Id) is
begin
- Binary_Op_Validity_Checks (N);
+ -- Share shift left circuit
+
+ Expand_N_Op_Shift_Left (N);
end Expand_N_Op_Shift_Right;
----------------------------------------
-- Note: in almost all C compilers it would work to just shift a
-- signed integer right, but it's undefined and we cannot rely on it.
+ -- Note: the above works fine for shift counts greater than or equal
+ -- to the word size, since in this case (not (Shift_Right (Mask, bits)))
+ -- generates all 1'bits.
+
-- What about non-binary modulus ???
declare
message @code{warning: 960 bits of "a" unused}. No other regular
expression notations are permitted. All characters other than asterisk in
these three specific cases are treated as literal characters in the match.
+The match is case insensitive, for example XYZ matches xyz.
The above use of patterns to match the message applies only to warning
messages generated by the front end. This form of the pragma with a
@emph{Check pragma casing.}
Pragma names must be written in mixed case, that is, the
initial letter and any letter following an underscore must be uppercase.
-All other letters must be lowercase.
+All other letters must be lowercase. An exception is that SPARK_Mode is
+allowed as an alternative for Spark_Mode.
@item ^r^REFERENCES^
@emph{Check references.}
@command{gnatmetric}. You also can combine this switch with
an explicit list of files.
+@item ^-j^/PROCESSES=^@var{n}
+@cindex @option{^-j^/PROCESSES^} (@command{gnatmetric})
+Use @var{n} processes to carry out the tree creations (internal representations
+of the argument sources). On a multiprocessor machine this speeds up processing
+of big sets of argument sources. If @var{n} is 0, then the maximum number of
+parallel tree creations is the number of core processors on the platform.
+
@item ^-v^/VERBOSE^
-@cindex @option{^-v^/VERBOSE^} (@code{gnatmetric})
+@cindex @option{^-v^/VERBOSE^} (@command{gnatmetric})
Verbose mode;
@command{gnatmetric} generates version information and then
a trace of sources being processed.
@item ^-q^/QUIET^
-@cindex @option{^-q^/QUIET^} (@code{gnatmetric})
+@cindex @option{^-q^/QUIET^} (@command{gnatmetric})
Quiet mode.
@end table
-- refers to a node or is posted on its source location, and has the
-- effect of inhibiting further messages involving this same node.
+ -----------------------
+ -- Modify_Tree_For_C --
+ -----------------------
+
+ -- If the flag Opt.Modify_Tree_For_C is set True, then the tree is modified
+ -- in ways that help match the semantics better with C, easing the task of
+ -- interfacing to C code generators (other than GCC, where the work is done
+ -- in gigi, and there is no point in changing that), and also making life
+ -- easier for Cprint in generating C source code.
+
+ -- The current modifications implemented are as follows:
+
+ -- N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic nodes
+ -- are eliminated from the tree (since these operations do not exist in
+ -- C), and the operations are rewritten in terms of logical shifts and
+ -- other logical operations that do exist in C. See Exp_Ch4 expansion
+ -- routines for these operators for details of the transformations made.
+
+ -- The right operand of N_Op_Shift_Right and N_Op_Shift_Left is always
+ -- less than the word size (since other values are not well-defined in
+ -- C). This is done using an explicit test if necessary.
+
------------------------------------
-- Description of Semantic Fields --
------------------------------------
-- plus fields for expression
-- Shift_Count_OK (Flag4-Sem)
+ -- Note: N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic
+ -- never appear in the expanded tree if Modify_Tree_For_C mode is set.
+
+ -- Note: For N_Op_Shift_Left and N_Op_Shift_Right, the right operand is
+ -- always less than the word size if Modify_Tree_For_C mode is set.
+
--------------------------
-- Obsolescent Features --
--------------------------
-- at the main project file will be parsed before the invocation of the
-- binder.
+ S_Metric_Processes : aliased constant S := "/PROCESSES=#" &
+ "-j#";
+
+ -- /NOPROCESSES (D)
+ -- /PROCESSES=NNN
+ --
+ -- Use NNN processes to carry out the tree creations (internal
+ -- representations of the argument sources). On a multiprocessor machine
+ -- this speeds up processing of big sets of argument sources. If NNN is 0,
+ -- then the maximum number of parallel tree creations is the number of
+ -- core processors on the platform.
+
S_Metric_Quiet : aliased constant S := "/QUIET " &
"-q";
-- /NOQUIET (D)
S_Metric_No_Local 'Access,
S_Metric_No_Static_Loop 'Access,
S_Metric_Project 'Access,
+ S_Metric_Processes 'Access,
S_Metric_Quiet 'Access,
S_Metric_Suffix 'Access,
S_Metric_Subdirs 'Access,