Sorry,

to better handle my message I've converted all bug fixes to unified diffs:


Hi,

I just compiled Mico 2.3.13 on MacOS X 10.4.11 (PPC) using gcc 4.0.1. After looking at some compiler warnings/errors I fixed some of them and have questions about some others:

2. /Users/tcs/src/CORBA/mico/coss/relship/RandomGenerator_impl.cc
RandomGenerator_impl::rand(): Value of variable 'number' may be returned uninitialized. This may in fact happen only on errors. F.e. an illegal 'mode' value. Three ways to resolve: a. Put body of the second 'if'-statement into the firsts 'else'- part. b. Report an error or raise an exception if 'mode' containes an unexpected value.
    c. Set 'number' to a defined value, f.e. 0.
d. Initialize 'number' to any defined value. This may especially be useful in case of detecting empty
        'random_numbers' to avoid compiler warning.

--- RandomGenerator_impl.cc     20 Feb 2008 15:22:25 -0000      1.1
+++ RandomGenerator_impl.cc     5 Jan 2009 21:54:21 -0000       1.2
@@ -42,9 +42,10 @@
 RandomGenerator_impl::rand ()
 {
   CORBA::Long number;
-  if (mode == RandomGenerator::generate)
+  if (mode == RandomGenerator::generate) {
     number = ::rand ();
-  if (mode == RandomGenerator::proxy) {
+  }
+  else if (mode == RandomGenerator::proxy) {
     if (!random_numbers.empty ()) {
       number = *(random_numbers.begin ());
       random_numbers.pop_front ();
@@ -53,8 +54,12 @@
       //::RandomGenerator::NoSuchNumber exception;
       //throw exception;
       mico_throw (RandomGenerator::NoSuchNumber());
+      number = 0; // Avoid compiler warnings
     }
   }
+  else {
+    number = 0; // Should never happen. Exception?
+  }

   return number;
 }

3. /Users/tcs/src/CORBA/mico/coss/relship/randomd.cc
    main(): Variable 'generator' should be initialized.

--- randomd.cc  20 Feb 2008 15:22:25 -0000      1.1
+++ randomd.cc  8 Jan 2009 14:07:09 -0000
@@ -45,7 +45,7 @@
 int main (int argc, char *argv[])
 {
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "mico-local- orb" );
-
+
CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA");
   PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj);
   PortableServer::POAManager_var mgr = poa->the_POAManager();
@@ -54,7 +54,7 @@
     usage (argv);
     exit (1);
   }
-  RandomGenerator_impl* generator;
+  RandomGenerator_impl* generator = (RandomGenerator_impl *) NULL;

   if (argc == 2) {
     if (strcmp (argv[1], "--generate") == 0) {
@@ -96,9 +96,3 @@
   return 0;
 }

-
-
-
-
-
-

4. /Users/tcs/src/CORBA/mico/demo/services/naming-lb/Printer_impl.cc
Printer_impl::~Printer_impl(): The printf-statement lacks its string argument. It should be written as

--- Printer_impl.cc     20 Feb 2008 15:22:59 -0000      1.1
+++ Printer_impl.cc     5 Jan 2009 21:41:55 -0000       1.2
@@ -26,7 +26,7 @@

 Printer_impl::~Printer_impl ()
 {
-  printf ("-- printer %s is destroyed\n");
+  printf ("-- printer %s is destroyed\n", printerName);

   if (this->printerName != NULL)
     free (this->printerName);

5. /Users/tcs/src/CORBA/mico/coss/naming/Naming_impl.cc
NamingContext_impl::restore(): 'binding.btype' may be used uninitialized. Its value will be assigned near end of the function depending on variable 'type'. What should happen if 'type' is
    neither "ncontext:" nor "nobject:"?

--- Naming_impl.cc      19 Dec 2008 14:46:20 -0000      1.1.1.2
+++ Naming_impl.cc      8 Jan 2009 14:10:39 -0000
@@ -214,6 +214,9 @@
     else if (strcmp (type.c_str(), "nobject:") == 0) {
       binding.btype = CosNaming::nobject;
     }
+       else {
+         // ToDo: Exception?
+       }

     /*
      * Insert into table

6. /Users/tcs/src/CORBA/mico/include/coss/NamedRoleTypesHelper.h
    /Users/tcs/src/CORBA/mico/include/coss/InterfaceDefsHelper.h
    /Users/tcs/src/CORBA/mico/include/coss/ GraphsRole_impl.h
    Preprocessor include directive should be fixed to:
Path prefix "coss/" was missing.

        #include "coss/CosRelationships.h"

        #include "coss/CosGraphs.h"
        #include "coss/Role_impl.h"

7. /Users/tcs/src/CORBA/mico/coss/relship/GraphsRole_impl.cc
CosGraphs_impl::Role_impl::Role_impl(): Initialization should be reordered like:

--- GraphsRole_impl.cc  20 Feb 2008 15:22:25 -0000      1.1
+++ GraphsRole_impl.cc  5 Jan 2009 21:43:07 -0000       1.2
@@ -40,7 +40,7 @@


CosGraphs_impl::Role_impl::Role_impl (CosRelationships::RelatedObject_ptr obj)
-  : POA_CosGraphs::Role (), ::Role_impl ()
+  : ::Role_impl (), POA_CosGraphs::Role ()
 {
 #if DEBUG
   cout << "  <CosGraphs::Role_impl> constructor with params\n";


Ciao

Thomas

--
Thomas Schmidt
Schneiderstr. 16
D-29575 Altenmedingen
Phone: +49-5807-209976
Cellular: +49-172-3011505
Skype: ThCSchmidt
Email: 01723011...@vodafone.de
PGP: Key-ID: 0x810B6206

_______________________________________________
Mico-devel mailing list
Mico-devel@mico.org
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to