Discussion:
Some minor bug fixes after first compilation
Schmidt Thomas
2008-12-22 12:06:24 UTC
Permalink
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:

1. /Users/tcs/src/CORBA/mico/coss/time/TimeService_impl.cc
TimeService_impl::universal_time(): Variable 'timeV' will be
used uninitialized! I don't know how to
fix.

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.

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

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

printf ("-- printer %s is destroyed\n", 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:"?

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:

#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:

CosGraphs_impl::Role_impl::Role_impl
(CosRelationships::RelatedObject_ptr obj)
: ::Role_impl (), POA_CosGraphs::Role ()

8. My compiler reports lots of (f.e. containmentd.cc:47 + 52)

"deprecated conversion from string constant to 'char*''

9. coss/relship will not generate the library stuff when being
configured with option '--enable-final'.


Mico installs well. Now trying out test suite and demos...


Ciao

Thomas

--
Thomas Schmidt
Schneiderstr. 16
D-29575 Altenmedingen
Phone: +49-5807-209976
Cellular: +49-172-3011505
Skype: ThCSchmidt
Email: ***@vodafone.de
PGP: Key-ID: 0x810B6206
Schmidt Thomas
2009-01-07 23:04:26 UTC
Permalink
It seems that this mail wasn't originally forwarded to the list.
Datum: 22. Dezember 2008 13:06:24 MEZ
Betreff: Some minor bug fixes after first compilation
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
1. /Users/tcs/src/CORBA/mico/coss/time/TimeService_impl.cc
TimeService_impl::universal_time(): Variable 'timeV' will be
used uninitialized! I don't know how to
fix.
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.
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.
3. /Users/tcs/src/CORBA/mico/coss/relship/randomd.cc
main(): Variable 'generator' should be initialized.
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
printf ("-- printer %s is destroyed\n", 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:"?
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
#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
CosGraphs_impl::Role_impl::Role_impl
(CosRelationships::RelatedObject_ptr obj)
: ::Role_impl (), POA_CosGraphs::Role ()
8. My compiler reports lots of (f.e. containmentd.cc:47 + 52)
"deprecated conversion from string constant to 'char*''
9. coss/relship will not generate the library stuff when being
configured with option '--enable-final'.
Mico installs well. Now trying out test suite and demos...
Ciao
Thomas
--
Thomas Schmidt
Schneiderstr. 16
D-29575 Altenmedingen
Phone: +49-5807-209976
Cellular: +49-172-3011505
Skype: ThCSchmidt
PGP: Key-ID: 0x810B6206
--
Thomas Schmidt
Schneiderstr. 16
D-29575 Altenmedingen
Phone: +49-5807-209976
Cellular: +49-172-3011505
Skype: ThCSchmidt
Email: ***@vodafone.de
PGP: Key-ID: 0x810B6206
Schmidt Thomas
2009-01-08 14:16:12 UTC
Permalink
Sorry,

to better handle my message I've converted all bug fixes to unified
Post by Schmidt Thomas
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
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.
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;
}
Post by Schmidt Thomas
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;
}

-
-
-
-
-
-
Post by Schmidt Thomas
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);
Post by Schmidt Thomas
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
Post by Schmidt Thomas
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
Path prefix "coss/" was missing.
Post by Schmidt Thomas
#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
--- 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: ***@vodafone.de
PGP: Key-ID: 0x810B6206

Continue reading on narkive:
Loading...