summaryrefslogtreecommitdiff
path: root/gcc/ada/argv.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-17 09:06:20 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-17 09:06:20 +0000
commit2588dbe80b53154a8a7d68eb4cbda531ab36e1f4 (patch)
tree756c6f16bfba7fb26f0b99204170088a8412a739 /gcc/ada/argv.c
parent458eb8f86acec37397b88a99c4497f2a952fa711 (diff)
downloadgcc-2588dbe80b53154a8a7d68eb4cbda531ab36e1f4.tar.gz
2009-04-17 Pascal Obry <obry@adacore.com>
* initialize.c: Set gnat_argv with UTF-8 encoded strings on Windows. * adaint.h, argv.c, bindgen.adb: Reverted to previous version. 2009-04-17 Robert Dewar <dewar@adacore.com> * a-except.adb, a-except-2005.adb: Add PE_Address_Of_Intrinsic * sem_attr.adb (Analyze_Attribute, case Address): Use PE_Address_Of_Intrinsic. * types.ads: Add PE_Address_Of_Intrinsic * types.h: Add PE_Address_Of_Intrinsic git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146226 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/argv.c')
-rw-r--r--gcc/ada/argv.c52
1 files changed, 4 insertions, 48 deletions
diff --git a/gcc/ada/argv.c b/gcc/ada/argv.c
index 6420967df56..b827b030f1e 100644
--- a/gcc/ada/argv.c
+++ b/gcc/ada/argv.c
@@ -46,73 +46,29 @@
#include "tconfig.h"
#include "tsystem.h"
#include <sys/stat.h>
-/* We don't have libiberty, so use malloc. */
-#define xmalloc(S) malloc (S)
#else
#include "config.h"
#include "system.h"
#endif
+#include "adaint.h"
+
/* argc and argv of the main program are saved under gnat_argc and gnat_argv,
envp of the main program is saved under gnat_envp. */
int gnat_argc = 0;
-char **gnat_argv = (char **) 0;
+const char **gnat_argv = (const char **) 0;
const char **gnat_envp = (const char **) 0;
#if defined (_WIN32) && !defined (RTX)
/* Note that on Windows environment the environ point to a buffer that could
be reallocated if needed. It means that gnat_envp needs to be updated
- before using gnat_envp to point to the right environment space. */
-#include "mingw32.h"
-#include <windows.h>
+ before using gnat_envp to point to the right environment space */
#include <stdlib.h>
/* for the environ variable definition */
#define gnat_envp (environ)
#endif
-#include "adaint.h"
-
-void
-__gnat_init_args (int argc, char **argv ATTRIBUTE_UNUSED, char **envp)
-{
-#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_COMPILE)
- char arg_utf8[MAX_PATH];
- LPWSTR *wargv;
- int wargc;
- int k;
-
- wargv = CommandLineToArgvW (GetCommandLineW(), &wargc);
-
- if (wargv == NULL)
- {
- /* CommandLineToArgvW was not successful, use standard argc/argv. */
- gnat_argv = argv;
- gnat_argc = argc;
- }
- else
- {
- /* Set gnat_argv with arguments encoded in UTF-8. */
- gnat_argv = (char **) xmalloc ((wargc + 1) * sizeof (char *));
-
- for (k=0; k<wargc; k++)
- {
- WS2SU (arg_utf8, wargv[k], MAX_PATH);
- gnat_argv[k] = (char *) xmalloc (strlen (arg_utf8) + 1);
- strcpy (gnat_argv[k], arg_utf8);
- }
-
- LocalFree (wargv);
- gnat_argc = wargc;
- }
-#else
- gnat_argv = argv;
- gnat_argc = argc;
-#endif
-
- gnat_envp = envp;
-}
-
int
__gnat_arg_count (void)
{