diff mbox

[Ada] gnatfind and source file names on Windows

Message ID 20130424142250.GA17225@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet April 24, 2013, 2:22 p.m. UTC
On Windows, when gnatfind is called with a pattern and a source file name
that includes capital letters, as in "gnatfind Put_Line:A-textio.ads -r",
gnatfind does not give the same output that it would have if the file
was not capitalized ("gnatfind Put_Line:a-textio.ads -r").
This is corrected by this patch.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-04-24  Vincent Celier  <celier@adacore.com>

	* xref_lib.adb (Add_Entity): Use the canonical file names
	so that source file names with capital letters are found on
	platforms where file names are case insensitive.
diff mbox

Patch

Index: xref_lib.adb
===================================================================
--- xref_lib.adb	(revision 198221)
+++ xref_lib.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1998-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 1998-2013, 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- --
@@ -272,18 +272,21 @@ 
          end if;
       end if;
 
-      File_Ref :=
-        Add_To_Xref_File
-          (Entity (File_Start .. Line_Start - 1), Visited => True);
-      Pattern.File_Ref := File_Ref;
+      declare
+         File_Name : String := Entity (File_Start .. Line_Start - 1);
+      begin
+         Osint.Canonical_Case_File_Name (File_Name);
+         File_Ref := Add_To_Xref_File (File_Name, Visited => True);
+         Pattern.File_Ref := File_Ref;
 
-      Add_Line (Pattern.File_Ref, Line_Num, Col_Num);
+         Add_Line (Pattern.File_Ref, Line_Num, Col_Num);
 
-      File_Ref :=
-        Add_To_Xref_File
-          (ALI_File_Name (Entity (File_Start .. Line_Start - 1)),
-           Visited      => False,
-           Emit_Warning => True);
+         File_Ref :=
+           Add_To_Xref_File
+             (ALI_File_Name (File_Name),
+              Visited      => False,
+              Emit_Warning => True);
+      end;
    end Add_Entity;
 
    -------------------