[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
This commit is contained in:
parent
6bde3eb52c
commit
55c078acd9
@ -1,3 +1,14 @@
|
||||
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>
|
||||
|
||||
* sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of
|
||||
|
@ -78,9 +78,38 @@ extern void __gnat_plist_init (void);
|
||||
#define EXPAND_ARGV_RATE 128
|
||||
|
||||
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;
|
||||
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)
|
||||
{
|
||||
@ -88,9 +117,11 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last)
|
||||
*argv = (char **) xrealloc (*argv, (*last) * sizeof (char *));
|
||||
}
|
||||
|
||||
size = WS2SC (NULL, value, 0);
|
||||
(*argv)[*index] = (char *) xmalloc (size + 1);
|
||||
WS2SC ((*argv)[*index], value, size);
|
||||
size = WS2SC (NULL, fullvalue, 0);
|
||||
(*argv)[*index] = (char *) xmalloc (size + sizeof(TCHAR));
|
||||
WS2SC ((*argv)[*index], fullvalue, size);
|
||||
|
||||
free (fullvalue);
|
||||
|
||||
(*index)++;
|
||||
}
|
||||
@ -143,7 +174,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
|
||||
/* argv[0] is the executable full path-name. */
|
||||
|
||||
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++)
|
||||
{
|
||||
@ -157,39 +188,51 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
|
||||
/* Wilcards are present, append all corresponding matches. */
|
||||
WIN32_FIND_DATA 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)
|
||||
{
|
||||
/* 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
|
||||
{
|
||||
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. */
|
||||
|
||||
do {
|
||||
append_arg (&argc_expanded,
|
||||
FileData.cFileName, &gnat_argv, &last);
|
||||
/* Do not add . and .. special entries */
|
||||
|
||||
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));
|
||||
|
||||
FindClose (hDir);
|
||||
|
||||
if (dir != NULL)
|
||||
free (dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No wildcard. Store parameter as-is. Remove quote if
|
||||
needed. */
|
||||
if (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);
|
||||
append_arg (&argc_expanded, NULL, wargv[k],
|
||||
&gnat_argv, &last, quoted);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2300,6 +2300,7 @@ package body Osint is
|
||||
declare
|
||||
Name : String renames Name_Buffer (1 .. Name_Len);
|
||||
Inc : String renames Include_Dir_Default_Prefix.all;
|
||||
|
||||
begin
|
||||
if Debug.Debug_Flag_Dot_N then
|
||||
Write_Line (Name);
|
||||
@ -2309,7 +2310,9 @@ package body Osint is
|
||||
and then Inc'Length < Name_Len
|
||||
and then Name_Buffer (1 .. Inc'Length) = Inc
|
||||
then
|
||||
null; -- Part of runtimes, so ignore it
|
||||
-- Part of runtimes, so ignore it
|
||||
|
||||
null;
|
||||
|
||||
else
|
||||
File_Name_Chars.Append_All (File_Name_Chars.Table_Type (Name));
|
||||
@ -2341,9 +2344,9 @@ package body Osint is
|
||||
begin
|
||||
-- Allocate source buffer, allowing extra character at end for EOF
|
||||
|
||||
-- Some systems (e.g. VMS) have file types that require one
|
||||
-- read per line, so read until we get the Len bytes or until
|
||||
-- there are no more characters.
|
||||
-- Some systems (e.g. VMS) have file types that require one read per
|
||||
-- line, so read until we get the Len bytes or until there are no
|
||||
-- more characters.
|
||||
|
||||
Hi := Lo;
|
||||
loop
|
||||
@ -2355,8 +2358,8 @@ package body Osint is
|
||||
Actual_Ptr (Hi) := EOF;
|
||||
|
||||
-- Now we need to work out the proper virtual origin pointer to
|
||||
-- return. This is exactly Actual_Ptr (0)'Address, but we have
|
||||
-- to be careful to suppress checks to compute this address.
|
||||
-- return. This is exactly Actual_Ptr (0)'Address, but we have to
|
||||
-- be careful to suppress checks to compute this address.
|
||||
|
||||
declare
|
||||
pragma Suppress (All_Checks);
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- 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 --
|
||||
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||
@ -691,10 +691,16 @@ package body Sem_Ch13 is
|
||||
-- Start of processing for Analyze_Attribute_Definition_Clause
|
||||
|
||||
begin
|
||||
-- Process Ignore_Rep_Clauses option
|
||||
|
||||
if Ignore_Rep_Clauses then
|
||||
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 |
|
||||
Attribute_Alignment |
|
||||
@ -710,7 +716,11 @@ package body Sem_Ch13 is
|
||||
Rewrite (N, Make_Null_Statement (Sloc (N)));
|
||||
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 |
|
||||
Attribute_Input |
|
||||
|
Loading…
Reference in New Issue
Block a user