Silence a few warnings

Jonathan Larmour jifl@eCosCentric.com
Fri Apr 16 03:32:00 GMT 2004


This patch fixes a few warnings around the place.

Jifl

Index: infra/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/infra/current/ChangeLog,v
retrieving revision 1.44
diff -u -5 -p -r1.44 ChangeLog
--- infra/current/ChangeLog	15 Apr 2004 01:07:32 -0000	1.44
+++ infra/current/ChangeLog	16 Apr 2004 03:27:36 -0000
@@ -1,5 +1,9 @@
+2004-04-16  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/cxxsupp.cxx: Allow inline function to be correctly inlined.
+
  2004-04-15  Jonathan Larmour  <jifl@eCosCentric.com>

  	* include/cyg_type.h: added CYG_ATTRIB_ALIGN_MAX and
  	CYGBLD_ATTRIB_ALIGNOFTYPE. Inspired by Robert Larice.
  	
Index: infra/current/tests/cxxsupp.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/infra/current/tests/cxxsupp.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 cxxsupp.cxx
--- infra/current/tests/cxxsupp.cxx	6 Oct 2003 17:29:01 -0000	1.4
+++ infra/current/tests/cxxsupp.cxx	16 Apr 2004 03:27:36 -0000
@@ -82,10 +82,15 @@ Pure::Pure(int i)
  void Pure::impure_fun1()
  {
      diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance);
  }

+inline void Pure::inline_fun1()
+{
+    diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance);
+}
+
  //==========================================================================

  class Derived : public Pure
  {
  public:
@@ -166,15 +171,10 @@ cyg_start( void )

      CYG_TEST_PASS_FINISH("C++ Support OK");
  }

  //==========================================================================
-
-void Pure::inline_fun1()
-{
-    diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance);
-}

  #else

  __externC void
  cyg_start( void )
Index: io/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/common/current/ChangeLog,v
retrieving revision 1.21
diff -u -5 -p -r1.21 ChangeLog
--- io/common/current/ChangeLog	19 Jan 2004 14:35:02 -0000	1.21
+++ io/common/current/ChangeLog	16 Apr 2004 03:27:36 -0000
@@ -1,5 +1,10 @@
+2004-04-16  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/iosys.c (cyg_io_lookup): Use union to avoid aliasing problems
+	with compiler.
+
  2004-01-19  Nick Garnett  <nickg@calivar.com>

  	* include/config_keys.h (CYG_IO_GET_CONFIG_DISK_INFO): Added DISK
  	IO config key base definition.

Index: io/common/current/src/iosys.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/common/current/src/iosys.c,v
retrieving revision 1.7
diff -u -5 -p -r1.7 iosys.c
--- io/common/current/src/iosys.c	23 May 2002 23:05:59 -0000	1.7
+++ io/common/current/src/iosys.c	16 Apr 2004 03:27:36 -0000
@@ -122,29 +122,33 @@ cyg_io_init(void)
  //

  Cyg_ErrNo
  cyg_io_lookup(const char *name, cyg_io_handle_t *handle)
  {
-    cyg_devtab_entry_t *t, *st;
+    union devtab_entry_handle_union {
+        cyg_devtab_entry_t *st;
+        cyg_io_handle_t h;
+    } stunion;
+    cyg_devtab_entry_t *t;
      Cyg_ErrNo res;
      const char *name_ptr;
      for (t = &__DEVTAB__[0]; t != &__DEVTAB_END__; t++) {
          if (cyg_io_compare(name, t->name, &name_ptr)) {
              // FUTURE: Check 'avail'/'online' here
              if (t->dep_name) {
-                res = cyg_io_lookup(t->dep_name, (cyg_io_handle_t *)&st);
+                res = cyg_io_lookup(t->dep_name, &stunion.h);
                  if (res != ENOERR) {
                      return res;
                  }
              } else {
-                st = (cyg_devtab_entry_t *)0;
+                stunion.st = NULL;
              }
              if (t->lookup) {
                  // This indirection + the name pointer allows the lookup 
routine
                  // to return a different 'devtab' handle.  This will 
provide for
                  // 'pluggable' devices, file names, etc.
-                res = (t->lookup)(&t, st, name_ptr);
+                res = (t->lookup)(&t, stunion.st, name_ptr);
                  if (res != ENOERR) {
                      return res;
                  }
              }
              *handle = (cyg_io_handle_t)t;
Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.43
diff -u -5 -p -r1.43 ChangeLog
--- io/fileio/current/ChangeLog	7 Apr 2004 11:18:53 -0000	1.43
+++ io/fileio/current/ChangeLog	16 Apr 2004 03:27:37 -0000
@@ -1,5 +1,9 @@
+2004-04-15  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/fileio1.c: include stdio.h for rename() prototype.
+
  2004-04-07  Andrew Lunn  <andrew.lunn@ascom.ch>

  	* src/fd.cxx: Fix the assert just added. 0 is a valid fd.

  2004-03-25  Sebastien Couret  <sebastien.couret@elios-informatique.fr>
Index: io/fileio/current/tests/fileio1.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/tests/fileio1.c,v
retrieving revision 1.4
diff -u -5 -p -r1.4 fileio1.c
--- io/fileio/current/tests/fileio1.c	29 May 2002 18:28:25 -0000	1.4
+++ io/fileio/current/tests/fileio1.c	16 Apr 2004 03:27:37 -0000
@@ -63,10 +63,11 @@

  #include <cyg/kernel/ktypes.h>         // base kernel types
  #include <cyg/infra/cyg_trac.h>        // tracing macros
  #include <cyg/infra/cyg_ass.h>         // assertion macros

+#include <stdio.h>
  #include <unistd.h>
  #include <fcntl.h>
  #include <sys/stat.h>
  #include <errno.h>
  #include <string.h>
Index: kernel/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.118
diff -u -5 -p -r1.118 ChangeLog
--- kernel/current/ChangeLog	14 Apr 2004 09:32:03 -0000	1.118
+++ kernel/current/ChangeLog	16 Apr 2004 03:27:41 -0000
@@ -1,5 +1,10 @@
+2004-04-15  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/fptest.c (do_test): Silence aliasing warning when breaking
+	doubles into two ints.
+
  2004-04-11  Andrew Lunn  <andrew.lunn@ascom.ch>

  	* doc/kernel.sgml: Expanded the documentation about the use of
  	CYG_FLAG_WAITMODE_CLR.


Index: kernel/current/tests/fptest.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/tests/fptest.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 fptest.c
--- kernel/current/tests/fptest.c	19 Feb 2004 10:57:36 -0000	1.5
+++ kernel/current/tests/fptest.c	16 Apr 2004 03:27:41 -0000
@@ -171,16 +171,25 @@ static void do_test( double *values,
          for( i = 0; i < count; i++ )
              sum += CALC;

          if( sum != last_sum )
          {
+            union double_int_union {
+                double d;
+                cyg_uint32 i[2];
+            } diu_sum, diu_lastsum;
+
+            diu_sum.d = sum;
+            diu_lastsum.d = last_sum;
+
              errors++;
+            if (sizeof(double) != 2*sizeof(cyg_uint32)) {
+                diag_printf("Warning: sizeof(double) != 
2*sizeof(cyg_uint32), therefore next line may\n"
+                            "have invalid sum/last_sum values\n");
+            }
              diag_printf("%s: Sum mismatch! %d sum=[%08x:%08x] 
last_sum=[%08x:%08x]\n",
-                        name,j,
-                        ((cyg_uint32 *)&sum)[0],((cyg_uint32 *)&sum)[1],
-                        ((cyg_uint32 *)&last_sum)[0],((cyg_uint32 
*)&last_sum)[1]
-                        );
+                        name,j, diu_sum.i[0], diu_sum.i[1], 
diu_lastsum.i[0], diu_lastsum.i[1] );
          }

  #if 0
          if( ((j*count)%1000000) == 0 )
              diag_printf("INFO:<%s: %2d calculations done>\n",name,j*count);





-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine



More information about the Ecos-patches mailing list