From: Arnaud Charlet Date: Mon, 20 Apr 2009 10:23:29 +0000 (+0200) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.5.0~6374 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fd1e8b0018d82b6830bd57d413e8429b379e580;p=thirdparty%2Fgcc.git [multiple changes] 2009-04-20 Thomas Quinot * s-oscons-tmplt.c: Add support for generating a dummy version of s-oscons.ads providing all possible constants. * g-socthi-mingw.ads: Fix calling convention for __gnat_inet_pton. * socket.c (__gnat_inet_pton): On Windows make sure we always use the ANSI version (not the UNICODE version) of WSAStringToAddress. 2009-04-20 Pascal Obry * adaint.c (__gnat_set_OWNER_ACL): properly free memory allocated for the security descriptor and make sure all handles are closed before leaving this procedure. From-SVN: r146392 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 80163b61035d..dbbd2eedcc95 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2009-04-20 Thomas Quinot + + * s-oscons-tmplt.c: Add support for generating a dummy version of + s-oscons.ads providing all possible constants. + + * g-socthi-mingw.ads: Fix calling convention for __gnat_inet_pton. + + * socket.c (__gnat_inet_pton): On Windows make sure we always use the + ANSI version (not the UNICODE version) of WSAStringToAddress. + +2009-04-20 Pascal Obry + + * adaint.c (__gnat_set_OWNER_ACL): properly free memory + allocated for the security descriptor and make sure all + handles are closed before leaving this procedure. + 2009-04-20 Javier Miranda * einfo.ads, einfo.adb (Is_Underlying_Record_View): New subprogram diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 497729714178..24719cf2fc4f 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -1820,8 +1820,8 @@ __gnat_check_OWNER_ACL PRIVILEGE_SET PrivilegeSet; DWORD dwPrivSetSize = sizeof (PRIVILEGE_SET); BOOL fAccessGranted = FALSE; - HANDLE hToken; - DWORD nLength; + HANDLE hToken = NULL; + DWORD nLength = 0; SECURITY_DESCRIPTOR* pSD = NULL; GetFileSecurity @@ -1839,14 +1839,14 @@ __gnat_check_OWNER_ACL (wname, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, pSD, nLength, &nLength)) - return 0; + goto error; if (!ImpersonateSelf (SecurityImpersonation)) - return 0; + goto error; if (!OpenThreadToken (GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, FALSE, &hToken)) - return 0; + goto error; /* Undoes the effect of ImpersonateSelf. */ @@ -1867,9 +1867,17 @@ __gnat_check_OWNER_ACL &dwPrivSetSize, /* size of PrivilegeSet buffer */ &dwAccessAllowed, /* receives mask of allowed access rights */ &fAccessGranted)) - return 0; + goto error; + CloseHandle (hToken); + HeapFree (GetProcessHeap (), 0, pSD); return fAccessGranted; + + error: + if (hToken) + CloseHandle (hToken); + HeapFree (GetProcessHeap (), 0, pSD); + return 0; } static void diff --git a/gcc/ada/g-socthi-mingw.ads b/gcc/ada/g-socthi-mingw.ads index 9c3ab0c0145b..49dd11c06297 100644 --- a/gcc/ada/g-socthi-mingw.ads +++ b/gcc/ada/g-socthi-mingw.ads @@ -234,7 +234,7 @@ private pragma Import (Stdcall, C_Getpeername, "getpeername"); pragma Import (Stdcall, C_Getsockname, "getsockname"); pragma Import (Stdcall, C_Getsockopt, "getsockopt"); - pragma Import (Stdcall, Inet_Pton, "__gnat_inet_pton"); + pragma Import (C, Inet_Pton, "__gnat_inet_pton"); pragma Import (Stdcall, C_Ioctl, "ioctlsocket"); pragma Import (Stdcall, C_Listen, "listen"); pragma Import (Stdcall, C_Recv, "recv"); diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index be35f1b216d2..2bcb80a6f0cd 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -79,10 +79,6 @@ pragma Style_Checks ("M32766"); ** **/ -#ifndef TARGET -# error Please define TARGET -#endif - #include #include #include @@ -95,6 +91,26 @@ pragma Style_Checks ("M32766"); #include "gsocket.h" +#ifdef DUMMY + +# if defined (TARGET) +# error TARGET may not be defined when generating the dummy version +# else +# define TARGET "batch runtime compilation (dummy values)" +# endif + +# if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS)) +# error Features missing on platform +# endif + +# define NATIVE + +#endif + +#ifndef TARGET +# error Please define TARGET +#endif + #ifndef HAVE_SOCKETS # include #endif @@ -109,8 +125,16 @@ pragma Style_Checks ("M32766"); #ifdef NATIVE #include + +#ifdef DUMMY +int counter = 0; +# define _VAL(x) counter++ +#else +# define _VAL(x) x +#endif + #define CND(name,comment) \ - printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) name)); + printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name))); #define CNS(name,comment) \ printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__); @@ -1179,9 +1203,11 @@ TXT(" Thread_Blocking_IO : constant Boolean := True;") /** ** System-specific constants follow + ** Each section should be activated if compiling for the corresponding + ** platform *or* generating the dummy version for runtime test compilation. **/ -#ifdef __vxworks +#if defined (__vxworks) || defined (DUMMY) /* @@ -1198,7 +1224,7 @@ CND(ERROR, "VxWorks generic error") #endif -#ifdef __MINGW32__ +#if defined (__MINGW32__) || defined (DUMMY) /* ------------------------------ @@ -1220,7 +1246,7 @@ CND(WSAEDISCON, "Disconnected") putchar ('\n'); #endif -#ifdef __APPLE__ +#if defined (__APPLE__) || defined (DUMMY) /* ------------------------------- diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c index 5ddaa39d6a2d..1c7de255c5c4 100644 --- a/gcc/ada/socket.c +++ b/gcc/ada/socket.c @@ -422,7 +422,7 @@ __gnat_inet_pton (int af, const char *src, void *dst) { int rc; ss.ss_family = af; - rc = WSAStringToAddress (src, af, NULL, (struct sockaddr *)&ss, &sslen); + rc = WSAStringToAddressA (src, af, NULL, (struct sockaddr *)&ss, &sslen); if (rc > 0) { switch (af) { case AF_INET: