diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cb672611b3d..f5da41edb9b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2009-05-06 Robert Dewar + + * sem_ch13.adb: Minor comment additions + + * osint.adb: Minor reformatting + +2009-05-06 Pascal Obry + + * initialize.c: On Windows, keep full pathname to expanded command + line patterns. + 2009-05-06 Ed Schonberg * sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c index 705cbf20e3c..ccad170c108 100644 --- a/gcc/ada/initialize.c +++ b/gcc/ada/initialize.c @@ -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