+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* wrapper.c (sim_target_parse_arg_array): Replace for loop with
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* TODO: Delete file.
e_sim_add_option_table (sd, bfin_mmu_options);
e_sim_add_option_table (sd, bfin_mach_options);
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-options.c (sim_parse_args): Declare local save_opterr. Save
+ opterr state to it before calling getopt_long and restore afterwards.
+ Set opterr to 0. When optc is '?', call sim_io_eprintf.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* hw-device.h (device): Delete commented typedef.
SIM_RC
sim_parse_args (SIM_DESC sd, char **argv)
{
- int c, i, argc, num_opts;
+ int c, i, argc, num_opts, save_opterr;
char *p, *short_options;
/* The `val' option struct entry is dynamically assigned for options that
only come in the long form. ORIG_VAL is used to get the original value
/* Ensure getopt is initialized. */
optind = 0;
+ /* Do not lot getopt throw errors for us. But don't mess with the state for
+ any callers higher up by saving/restoring it. */
+ save_opterr = opterr;
+ opterr = 0;
+
while (1)
{
int longind, optc;
}
if (optc == '?')
{
+ /* If getopt rejects a short option, optopt is set to the bad char.
+ If it rejects a long option, we have to look at optind. In the
+ short option case, argv could be multiple short options. */
+ const char *badopt;
+ char optbuf[3];
+
+ if (optopt)
+ {
+ sprintf (optbuf, "-%c", optopt);
+ badopt = optbuf;
+ }
+ else
+ badopt = argv[optind - 1];
+
+ sim_io_eprintf (sd,
+ "%s: unrecognized option: %s\n"
+ "Use --help for a complete list of options.\n",
+ STATE_MY_NAME (sd), badopt);
+
result = SIM_RC_FAIL;
break;
}
}
}
+ opterr = save_opterr;
+
free (long_options);
free (short_options);
free (handlers);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (cris_devices): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* TODO: Delete file.
augment the meaning of an option. */
sim_add_option_table (sd, NULL, frv_options);
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * compile.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
return 0;
}
- /* getopt will print the error message so we just have to exit if
- this fails. FIXME: Hmmm... in the case of gdb we need getopt
- to call print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
/* Uninstall the modules to avoid memory leaks,
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* iq2000-sim.h: Delete file.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* TODO: Delete file.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (sim_state): Delete devices member.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
/* Uninstall the modules to avoid memory leaks,
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
sim_add_option_table (sd, NULL, mips_options);
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
/* Uninstall the modules to avoid memory leaks,
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
sim_do_command (sd, "memory region 0,0x100000");
sim_do_command (sd, "memory region 0x40000000,0x200000");
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
/* Uninstall the modules to avoid memory leaks,
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* interp.c (count_argc): Delete.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* sh64-sim.h (GETTWI, SETTWI): Delete unused defines.
return 0;
}
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
free_state (sd);
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Update sim_parse_args comment.
+
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
/* similarly if in the internal RAM region */
sim_do_command (sd, "memory region 0xffe000,0x1000,1024");
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
+ /* The parser will print an error message for us, so we silently return. */
if (sim_parse_args (sd, argv) != SIM_RC_OK)
{
/* Uninstall the modules to avoid memory leaks,