Pacify GCC: const char * passed to asprintf; int function returning
authorAndrew Cagney <cagney@redhat.com>
Sat, 28 Feb 1998 03:01:51 +0000 (03:01 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 28 Feb 1998 03:01:51 +0000 (03:01 +0000)
void; unused variable.

sim/common/ChangeLog
sim/common/sim-module.c
sim/common/sim-options.c

index e362e28eedfba7ef47150d31cde8495365f5adad..dc11d98fe1d76204e5c3a5f25a2641bab01b40b0 100644 (file)
@@ -1,3 +1,12 @@
+Sat Feb 28 13:54:10 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * sim-module.c (sim_pre_argv_init): String passed to asprintf
+       can't be constant.
+       
+       * sim-options.c (sim_parse_args): Ditto.
+       (sim_args_command): Return OK, instead of nothing, for an empty
+       command.
+
 Fri Feb 27 13:29:13 1998  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * sim-profile.c (profile_info): Rename from profile_print. Drop
index bb1dca4e11e114b7ab00c66e8d240d8bc323260c..c3a92ceae70a229604570219c0c3c2ab630a43c5 100644 (file)
@@ -81,7 +81,7 @@ sim_pre_argv_init (SIM_DESC sd, const char *myname)
     int i;
     for (i = 0; i < MAX_NR_PROCESSORS; ++i)
       {
-       const char *name;
+       char *name;
        asprintf (&name, "cpu%d", i);
        CPU_NAME (STATE_CPU (sd, i)) = name;
       }
index ca38af5892d88a5faf6177f91ed62d704f55973e..e94f9aad43d84579ea619890f1c2ded46526862f 100644 (file)
@@ -553,9 +553,11 @@ sim_parse_args (sd, argv)
              }
            if (opt->opt.name != NULL)
              {
+               char *name;
                *lp = opt->opt;
                /* Prepend --<cpuname>- to the option.  */
-               asprintf (&lp->name, "%s-%s", CPU_NAME (cpu), lp->name);
+               asprintf (&name, "%s-%s", CPU_NAME (cpu), lp->name);
+               lp->name = name;
                /* Dynamically assign `val' numbers for long options. */
                lp->val = i++;
                handlers[lp->val] = opt->handler;
@@ -851,10 +853,9 @@ sim_args_command (SIM_DESC sd, char *cmd)
       const OPTION *matching_opt = NULL;
       int matching_argi;
       sim_cpu *cpu;
-      int argi = 0;
 
       if (argv [0] == NULL)
-       return;
+       return SIM_RC_OK; /* FIXME - perhaphs help would be better */
 
       /* First check for a cpu selector.  */
       {