Commit 55c078ac by Arnaud Charlet

[multiple changes]

2009-05-06  Robert Dewar  <dewar@adacore.com>

	* sem_ch13.adb: Minor comment additions

	* osint.adb: Minor reformatting

2009-05-06  Pascal Obry  <obry@adacore.com>

	* initialize.c: On Windows, keep full pathname to expanded command
	line patterns.

From-SVN: r147150
parent 6bde3eb5
2009-05-06 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb: Minor comment additions
* osint.adb: Minor reformatting
2009-05-06 Pascal Obry <obry@adacore.com>
* initialize.c: On Windows, keep full pathname to expanded command
line patterns.
2009-05-06 Ed Schonberg <schonberg@adacore.com> 2009-05-06 Ed Schonberg <schonberg@adacore.com>
* sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of * sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of
......
...@@ -78,9 +78,38 @@ extern void __gnat_plist_init (void); ...@@ -78,9 +78,38 @@ extern void __gnat_plist_init (void);
#define EXPAND_ARGV_RATE 128 #define EXPAND_ARGV_RATE 128
static void static void
append_arg (int *index, LPWSTR value, char ***argv, int *last) append_arg (int *index, LPWSTR dir, LPWSTR value,
char ***argv, int *last, int quoted)
{ {
int size; int size;
LPWSTR fullvalue;
int vallen = _tcslen (value);
int dirlen;
if (dir == NULL)
{
/* no dir prefix */
dirlen = 0;
fullvalue = xmalloc ((vallen + 1) * sizeof(TCHAR));
}
else
{
/* Add dir first */
dirlen = _tcslen (dir);
fullvalue = xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR));
_tcscpy (fullvalue, dir);
}
/* Append value */
if (quoted)
{
_tcsncpy (fullvalue + dirlen, value + 1, vallen - 1);
fullvalue [dirlen + vallen - sizeof(TCHAR)] = _T('\0');
}
else
_tcscpy (fullvalue + dirlen, value);
if (*last <= *index) if (*last <= *index)
{ {
...@@ -88,9 +117,11 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last) ...@@ -88,9 +117,11 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last)
*argv = (char **) xrealloc (*argv, (*last) * sizeof (char *)); *argv = (char **) xrealloc (*argv, (*last) * sizeof (char *));
} }
size = WS2SC (NULL, value, 0); size = WS2SC (NULL, fullvalue, 0);
(*argv)[*index] = (char *) xmalloc (size + 1); (*argv)[*index] = (char *) xmalloc (size + sizeof(TCHAR));
WS2SC ((*argv)[*index], value, size); WS2SC ((*argv)[*index], fullvalue, size);
free (fullvalue);
(*index)++; (*index)++;
} }
...@@ -143,7 +174,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED) ...@@ -143,7 +174,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
/* argv[0] is the executable full path-name. */ /* argv[0] is the executable full path-name. */
SearchPath (NULL, wargv[0], _T(".exe"), MAX_PATH, result, NULL); SearchPath (NULL, wargv[0], _T(".exe"), MAX_PATH, result, NULL);
append_arg (&argc_expanded, result, &gnat_argv, &last); append_arg (&argc_expanded, NULL, result, &gnat_argv, &last, 0);
for (k=1; k<wargc; k++) for (k=1; k<wargc; k++)
{ {
...@@ -157,39 +188,51 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED) ...@@ -157,39 +188,51 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
/* Wilcards are present, append all corresponding matches. */ /* Wilcards are present, append all corresponding matches. */
WIN32_FIND_DATA FileData; WIN32_FIND_DATA FileData;
HANDLE hDir = FindFirstFile (wargv[k], &FileData); HANDLE hDir = FindFirstFile (wargv[k], &FileData);
LPWSTR dir = NULL;
LPWSTR ldir = _tcsrchr (wargv[k], _T('\\'));
if (ldir == NULL)
ldir = _tcsrchr (wargv[k], _T('/'));
if (hDir == INVALID_HANDLE_VALUE) if (hDir == INVALID_HANDLE_VALUE)
{ {
/* No match, append arg as-is. */ /* No match, append arg as-is. */
append_arg (&argc_expanded, wargv[k], &gnat_argv, &last); append_arg (&argc_expanded, NULL, wargv[k],
&gnat_argv, &last, quoted);
} }
else else
{ {
if (ldir != NULL)
{
int n = ldir - wargv[k] + 1;
dir = xmalloc ((n + 1) * sizeof (TCHAR));
_tcsncpy (dir, wargv[k], n);
dir[n] = _T('\0');
}
/* Append first match and all remaining ones. */ /* Append first match and all remaining ones. */
do { do {
append_arg (&argc_expanded, /* Do not add . and .. special entries */
FileData.cFileName, &gnat_argv, &last);
if (_tcscmp (FileData.cFileName, _T(".")) != 0
&& _tcscmp (FileData.cFileName, _T("..")) != 0)
append_arg (&argc_expanded, dir, FileData.cFileName,
&gnat_argv, &last, 0);
} while (FindNextFile (hDir, &FileData)); } while (FindNextFile (hDir, &FileData));
FindClose (hDir); FindClose (hDir);
if (dir != NULL)
free (dir);
} }
} }
else else
{ {
/* No wildcard. Store parameter as-is. Remove quote if /* No wildcard. Store parameter as-is. Remove quote if
needed. */ needed. */
if (quoted) append_arg (&argc_expanded, NULL, wargv[k],
{ &gnat_argv, &last, quoted);
int len = _tcslen (wargv[k]);
/* Remove ending quote */
wargv[k][len-1] = _T('\0');
append_arg
(&argc_expanded, &wargv[k][1], &gnat_argv, &last);
}
else
append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
} }
} }
......
...@@ -2300,6 +2300,7 @@ package body Osint is ...@@ -2300,6 +2300,7 @@ package body Osint is
declare declare
Name : String renames Name_Buffer (1 .. Name_Len); Name : String renames Name_Buffer (1 .. Name_Len);
Inc : String renames Include_Dir_Default_Prefix.all; Inc : String renames Include_Dir_Default_Prefix.all;
begin begin
if Debug.Debug_Flag_Dot_N then if Debug.Debug_Flag_Dot_N then
Write_Line (Name); Write_Line (Name);
...@@ -2309,7 +2310,9 @@ package body Osint is ...@@ -2309,7 +2310,9 @@ package body Osint is
and then Inc'Length < Name_Len and then Inc'Length < Name_Len
and then Name_Buffer (1 .. Inc'Length) = Inc and then Name_Buffer (1 .. Inc'Length) = Inc
then then
null; -- Part of runtimes, so ignore it -- Part of runtimes, so ignore it
null;
else else
File_Name_Chars.Append_All (File_Name_Chars.Table_Type (Name)); File_Name_Chars.Append_All (File_Name_Chars.Table_Type (Name));
...@@ -2341,9 +2344,9 @@ package body Osint is ...@@ -2341,9 +2344,9 @@ package body Osint is
begin begin
-- Allocate source buffer, allowing extra character at end for EOF -- Allocate source buffer, allowing extra character at end for EOF
-- Some systems (e.g. VMS) have file types that require one -- Some systems (e.g. VMS) have file types that require one read per
-- read per line, so read until we get the Len bytes or until -- line, so read until we get the Len bytes or until there are no
-- there are no more characters. -- more characters.
Hi := Lo; Hi := Lo;
loop loop
...@@ -2355,8 +2358,8 @@ package body Osint is ...@@ -2355,8 +2358,8 @@ package body Osint is
Actual_Ptr (Hi) := EOF; Actual_Ptr (Hi) := EOF;
-- Now we need to work out the proper virtual origin pointer to -- Now we need to work out the proper virtual origin pointer to
-- return. This is exactly Actual_Ptr (0)'Address, but we have -- return. This is exactly Actual_Ptr (0)'Address, but we have to
-- to be careful to suppress checks to compute this address. -- be careful to suppress checks to compute this address.
declare declare
pragma Suppress (All_Checks); pragma Suppress (All_Checks);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2009, 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- --
...@@ -691,10 +691,16 @@ package body Sem_Ch13 is ...@@ -691,10 +691,16 @@ package body Sem_Ch13 is
-- Start of processing for Analyze_Attribute_Definition_Clause -- Start of processing for Analyze_Attribute_Definition_Clause
begin begin
-- Process Ignore_Rep_Clauses option
if Ignore_Rep_Clauses then if Ignore_Rep_Clauses then
case Id is case Id is
-- The following should be ignored -- The following should be ignored. They do not affect legality
-- and may be target dependent. The basic idea of -gnatI is to
-- ignore any rep clauses that may be target dependent but do not
-- affect legality (except possibly to be rejected because they
-- are incompatible with the compilation target).
when Attribute_Address | when Attribute_Address |
Attribute_Alignment | Attribute_Alignment |
...@@ -710,7 +716,11 @@ package body Sem_Ch13 is ...@@ -710,7 +716,11 @@ package body Sem_Ch13 is
Rewrite (N, Make_Null_Statement (Sloc (N))); Rewrite (N, Make_Null_Statement (Sloc (N)));
return; return;
-- The following should not be ignored -- The following should not be ignored, because in the first place
-- they are reasonably portable, and should not cause problems in
-- compiling code from another target, and also they do affect
-- legality, e.g. failing to provide a stream attribute for a
-- type may make a program illegal.
when Attribute_External_Tag | when Attribute_External_Tag |
Attribute_Input | Attribute_Input |
......
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