This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on trunk
This patch enchances the machinery which detects redundant qualifications
Source:
procedure T is
type New_Positive is new Positive;
procedure Y (V : New_Positive) is begin null; end Y;
P : constant Positive := 1;
New_P : constant New_Positive := 2;
begin
Y (New_Positive (New_P));
for Loop_New_P in 1 .. New_P loop
Y (Loop_New_P);
Y (New_Positive (Loop_New_P));
Y (New_Positive'(New_P));
Y (New_Positive'(Loop_New_P));
end loop;
end T;
Compilation:
gnatmake -gnatwr t.adb
Output:
t.adb:7:10: warning: redundant conversion, "New_P" is of type "New_Positive"
t.adb:10:13: warning: redundant conversion, "Loop_New_P" is of type "New_Positive"
2007-08-31 Hristian Kirtchev <kirtchev@adacore.com>
* restrict.adb, namet.adb, par-util.adb: Remove redundant type
conversion.
* sem_res.adb (Resolve_Qualified_Expression): Add machinery to detect
simple redundant qualifications. The check is performed whenever the
expression is a non-overloaded identifier.
(Resolve_Type_Conversion): Enchance the redundant type conversion check
to include loop parameters.
(Valid_Conversion): Avoid generation of spurious error message.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |