[patch] various small compile fixes

View: New views
2 Messages — Rating Filter:   Alert me  

[patch] various small compile fixes

by Hans Nieuwenhuis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list,

Tonight I decided to recompile mspgcc (430X branch) on Ubuntu Jaunty (9.04). GCC 4.3.3 bailed out at various points (binutils and gdb) complaining about ignored return values 'warn_unused_results'.
I made a set of patches and modified the makefile in the packaging module to use the patches.
The patches are all compile fixes and nothing mspgcc specific, but they can be useful for anyone experiencing the same problem as I had.

How to use:

- Patch makefile using makefile.patch
- Copy the other patches to the patch/ directory (NB: do not apply them manually!)

Enjoy,

Hans


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@...
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Parent Message unknown Re: [patch] various small compile fixes

by Hans Nieuwenhuis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 12 Sep 2009 09:50:05 -0400
Przemek Klosowski <przemek.klosowski@...> wrote:

> On Fri, Sep 11, 2009 at 6:46 PM, Hans Nieuwenhuis <vzzbx@...>
> wrote:
>
> > I made a set of patches and modified the makefile in the packaging
> > module to use the patches.
> >
>
> Did you mean to attach the patches to your message? I don't think they
> made it to the list.
> BTW, the compilation messages you mentioned looked like warnings, and
> should not have prevented the build from completing---did they really
> stop the compilation?

Hmm, I included them as attachments but they got stripped of by the
mailinglist. I'll include them as text instead.

To answer your question, yeah, on my system compilation stopped with an
error. It behaves like -Werr is switched on, but gazing at the log I
could not find a reference to it. Could it be system wide setting in GCC
which causes this? Again, I am on Ubuntu 9.04 using gcc 4.3.3.

>

--- makefile.old 2009-09-12 00:31:42.000000000 +0200
+++ makefile 2009-09-12 00:30:14.000000000 +0200
@@ -222,6 +222,10 @@
  cd $(BUILDDIR)/$(BINUTILS); patch -p1 <
$(PATCHES)/binutils-2.18-msp430x24x-msp430x26x.patch cd
$(BUILDDIR)/$(BINUTILS); patch -p1 < $(PATCHES)/binutils-ld_scripts.patch
cd $(BUILDDIR)/$(BINUTILS); patch -p1 <
$(PATCHES)/binutils-2.18-430X.patch
+ cd $(BUILDDIR)/$(BINUTILS); patch -p1 <
$(PATCHES)/binutils-2.18-cxxfilt.patch
+ cd $(BUILDDIR)/$(BINUTILS); patch -p1 <
$(PATCHES)/binutils-2.18-read.patch
+ cd $(BUILDDIR)/$(BINUTILS); patch -p1 <
$(PATCHES)/binutils-2.18-stabs.patch +
  @echo "## Configure and building binutils (this takes a while)"
  cd $(BUILDDIR)/$(BINUTILS) && ./configure --target=msp430
$(CROSSOPT) --prefix=$(PREFIX) \
                 --disable-nls --disable-shared --enable-debug
--disable-threads \ @@ -304,6 +308,13 @@
  #~ cd $(BUILDDIR)/gdb-$(GDB_VERSION)&& patch -p1 <
$(PATCHES)/gdb-6.7.1-msp430-20080313.patch cd
$(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-430X.patch #~ uname -a | grep x86_64 && cd
$(BUILDDIR)/gdb-$(GDB_VERSION)&& patch -p1 <
$(PATCHES)/gdb-6.7.1-64bit.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-cli-cmds.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-mi-cmd-env.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-main.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-top.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-utils.patch
+ cd $(BUILDDIR)/gdb-$(GDB_VERSION) && patch -p1 <
$(PATCHES)/gdb-6.8-inflow.patch +
  @echo "## Configuring and building msp430-gdb (this takes a
while)" cd $(BUILDDIR)/gdb-$(GDB_VERSION)&& ./configure \
             --enable-targets=msp430 --target=msp430 \


--- gdb-6.8/gdb/inflow.c.orig 2009-09-11 23:26:35.000000000 +0200
+++ gdb-6.8/gdb/inflow.c 2009-09-11 23:27:41.000000000 +0200
@@ -513,6 +513,7 @@
 new_tty (void)
 {
   int tty;
+  int ret;
 
   if (inferior_thisrun_terminal == 0)
     return;
@@ -545,17 +546,17 @@
   if (tty != 0)
     {
       close (0);
-      dup (tty);
+      ret = dup (tty);
     }
   if (tty != 1)
     {
       close (1);
-      dup (tty);
+      ret = dup (tty);
     }
   if (tty != 2)
     {
       close (2);
-      dup (tty);
+      ret = dup (tty);
     }
   if (tty > 2)
     close (tty);


--- gdb-6.8/gdb/utils.c.orig 2009-09-11 23:07:05.000000000 +0200
+++ gdb-6.8/gdb/utils.c 2009-09-11 23:08:05.000000000 +0200
@@ -689,6 +689,7 @@
   int quit_p;
   int dump_core_p;
   char *reason;
+  int ret;
 
   /* Don't allow infinite error/warning recursion.  */
   {
@@ -704,7 +705,7 @@
  abort (); /* NOTE: GDB has only three calls to abort().
*/ default:
  dejavu = 3;
- write (STDERR_FILENO, msg, sizeof (msg));
+ ret = write (STDERR_FILENO, msg, sizeof (msg));
  exit (1);
       }
   }


--- gdb-6.8/gdb/top.c.orig 2009-09-11 22:46:14.000000000 +0200
+++ gdb-6.8/gdb/top.c 2009-09-11 22:48:07.000000000 +0200
@@ -1623,12 +1623,14 @@
 void
 gdb_init (char *argv0)
 {
+  char *cwd_ret;
+
   if (pre_init_ui_hook)
     pre_init_ui_hook ();
 
   /* Run the init function of each source file */
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  cwd_ret = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   current_directory = gdb_dirbuf;
 
 #ifdef __MSDOS__


--- gdb-6.8/gdb/main.c.orig 2009-09-11 22:46:03.000000000 +0200
+++ gdb-6.8/gdb/main.c 2009-09-11 22:47:37.000000000 +0200
@@ -159,6 +159,8 @@
   struct stat homebuf, cwdbuf;
   char *homedir;
 
+  char *cwd_ret;
+
   int i;
 
   long time_at_startup = get_run_time ();
@@ -188,7 +190,7 @@
   line[0] = '\0'; /* Terminate saved (now empty) cmd line
*/ instream = stdin;
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  cwd_ret = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   current_directory = gdb_dirbuf;
 
   gdb_stdout = stdio_fileopen (stdout);


--- gdb-6.8/gdb/mi/mi-cmd-env.c.orig 2009-09-11 22:11:54.000000000
+0200 +++ gdb-6.8/gdb/mi/mi-cmd-env.c 2009-09-11
22:14:04.000000000 +0200 @@ -67,6 +67,8 @@
 enum mi_cmd_result
 mi_cmd_env_pwd (char *command, char **argv, int argc)
 {
+  char *cwd_ret;
+
   if (argc > 0)
     error (_("mi_cmd_env_pwd: No arguments required"));
           
@@ -78,7 +80,7 @@
     
   /* Otherwise the mi level is 2 or higher.  */
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  cwd_ret = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   ui_out_field_string (uiout, "cwd", gdb_dirbuf);
 
   return MI_CMD_DONE;


--- gdb-6.8/gdb/cli/cli-cmds.c.orig 2009-09-11 21:53:56.000000000
+0200 +++ gdb-6.8/gdb/cli/cli-cmds.c 2009-09-11 21:55:34.000000000
+0200 @@ -318,9 +318,11 @@
 static void
 pwd_command (char *args, int from_tty)
 {
+  char *cwd_ret;
+
   if (args)
     error (_("The \"pwd\" command does not take an argument: %s"), args);
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  cwd_ret = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
 
   if (strcmp (gdb_dirbuf, current_directory) != 0)
     printf_unfiltered (_("Working directory %s\n (canonically %s).\n"),


--- binutils-2.18/gas/stabs.c.orig 2009-09-11 21:22:04.000000000
+0200 +++ binutils-2.18/gas/stabs.c 2009-09-11 21:25:14.000000000
+0200 @@ -658,6 +658,7 @@
   char *buf;
   char *file;
   unsigned int lineno;
+  int asp_ret;
 
   if (! void_emitted_p)
     {
@@ -667,8 +668,8 @@
     }
 
   as_where (&file, &lineno);
-  asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
-    funcname, N_FUN, lineno + 1, startlabname);
+  asp_ret = asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
+      funcname, N_FUN, lineno + 1, startlabname);
   input_line_pointer = buf;
   s_stab ('s');
   free (buf);
@@ -688,12 +689,13 @@
   char *hold = input_line_pointer;
   char *buf;
   char sym[30];
+  int asp_ret;
 
   sprintf (sym, "%sendfunc%d", FAKE_LABEL_NAME, label_count);
   ++label_count;
   colon (sym);
 
-  asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym, startlabname);
+  asp_ret = asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym,
startlabname); input_line_pointer = buf;
   s_stab ('s');
   free (buf);


--- binutils-2.18/gas/read.c.orig 2007-08-06 21:59:51.000000000
+0200 +++ binutils-2.18/gas/read.c 2009-09-11 21:14:46.000000000
+0200 @@ -5612,6 +5612,7 @@
     {
       char *name, *label;
       char delim1, delim2;
+      int asp_ret;
 
       if (current_name != NULL)
  {
@@ -5628,14 +5629,14 @@
       if (*input_line_pointer != ',')
  {
   if (default_prefix)
-    asprintf (&label, "%s%s", default_prefix, name);
+    asp_ret = asprintf (&label, "%s%s", default_prefix, name);
   else
     {
       char leading_char = bfd_get_symbol_leading_char
(stdoutput); /* Missing entry point, use function's name with the leading
  char prepended.  */
       if (leading_char)
- asprintf (&label, "%c%s", leading_char, name);
+ asp_ret = asprintf (&label, "%c%s", leading_char, name);
       else
  label = name;
     }


--- binutils-2.18/binutils/cxxfilt.c.orig 2009-09-11
21:02:33.000000000 +0200 +++ binutils-2.18/binutils/cxxfilt.c
2009-09-11 21:04:12.000000000 +0200 @@ -63,12 +63,12 @@
   result = cplus_demangle (mangled_name + skip_first, flags);
 
   if (result == NULL)
-    printf (mangled_name);
+    printf ("%s", mangled_name);
   else
     {
       if (mangled_name[0] == '.')
  putchar ('.');
-      printf (result);
+      printf ("%s", result);
       free (result);
     }
 }



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@...
https://lists.sourceforge.net/lists/listinfo/mspgcc-users