Markus Schaber
2008-07-08 09:42:38 UTC
Hi,
We are using mico for one of our projects inhouse, and we falsely got
the impression that mico was not maintained any more (no releases,
debian packages vanishing, and no time to really investigate the
issues.). Yesterday, I had some time to look at the mico website, and
found out that mico still is actively worked on, and I think that we
may have something to contribute.
Building mico (latest release) and our software with GCC 4.3.1, we
stumbled over some bugs and warnings. We fixed them inhouse by patching
the mico source, being unaware that some of them were already fixed in
darcs HEAD.
The first issue were lots of warnings about deprecated casts of string
literals to char*, all of those seem fixed in mico head.
Some other issue are the strict alias warnings, which are worked-around
with -fno-strict-aliasing both inhouse and in darcs HEAD. As this is
only a workaround which also disables some optimizations, we intend to
"really" fix those issues, but I can't give any promise or timeline.
Also, I don't know whether someone else is working on this issue.
The next one was the issue in idl/codegen-midl.cc where insert_guid()
was writing into a string constant. The fix you provided in HEAD seems
to look like a memory leak to me, as the string should be freed with
CORBA::string_free() at the end.
We had a different fix for that, which also has the advantage that it
does allocate the buffer on the stack which is cheaper on most
platforms. (Patch against HEAD)
diff -rN -u old-head/idl/codegen-midl.cc new-head/idl/codegen-midl.cc
--- old-head/idl/codegen-midl.cc 2008-07-08 11:08:16.179497000 +0200
+++ new-head/idl/codegen-midl.cc 2008-07-08 11:08:18.419637000 +0200
@@ -1604,7 +1604,7 @@
void CodeGenMIDL::insert_guid()
{
- char* szGUID = CORBA::string_dup("(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)");
+ char szGUID[39] = "(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)";
#if defined(_WIN32) && !defined(__MINGW32__)
GUID g;
Another issue was a missing include[1]. "throw.h" uses strcmp() without
including <string.h>.
diff -rN -u old-head/include/mico/throw.h new-head/include/mico/throw.h
--- old-head/include/mico/throw.h 2008-07-08 11:08:16.443513500 +0200
+++ new-head/include/mico/throw.h 2008-07-08 11:08:19.207686250 +0200
@@ -25,7 +25,7 @@
#define __mico_throw_h__
#include <stdarg.h>
-
+#include <string.h>
#ifdef HAVE_EXCEPTIONS
#define MICO_CATCHANY(x) try { x; } catch (...) {}
The last one for now is an exception declaration problem. Unless I
messed up something here, it seems that only HEAD is affected, and not
the stable release. I had a quick fix to make it compile, but I think
that the real problem is a misdetection of HAVE_FINITE_PROTO.
/usr/include/bits/mathcalls.h:205: error: declaration of ‘int finite(double) throw ()’ throws different exceptions
../include/mico/util.h:222: error: from previous declaration ‘int finite(double)’
The ugly, broken quick fix is:
diff -rN -u old-head/include/mico/util.h new-head/include/mico/util.h
--- old-head/include/mico/util.h 2008-07-08 11:08:16.447513750 +0200
+++ new-head/include/mico/util.h 2008-07-08 11:08:19.211686500 +0200
@@ -219,7 +219,7 @@
#endif
#ifndef HAVE_FINITE_PROTO
-extern "C" int finite (double);
+extern "C" int finite (double) throw();
#endif
#ifndef HAVE_FTIME_PROTO
As I have no clue of that autoconf stuff, I'm not sure yet whether the
problem is on my side in my environments here.
There are still some few warnings I'll investigate and bring up in a
later email.
Thanks for your patience and your great work,
Markus
Footnotes:
[1] One of the changes of either newer GCC/listdc++ or newer glibc
against older versions seems that they removed some implicit includes.
In earlier versions of the standard library, some headers
"accidentally" included other headers, so code that missed some
#include-directives actually compiled. Also, incidentally including the
missing header directly (or indirectly) in your own code before the
broken header "hides" the missing include, so such bugs can linger in
the code for decades before being noticed.
We are using mico for one of our projects inhouse, and we falsely got
the impression that mico was not maintained any more (no releases,
debian packages vanishing, and no time to really investigate the
issues.). Yesterday, I had some time to look at the mico website, and
found out that mico still is actively worked on, and I think that we
may have something to contribute.
Building mico (latest release) and our software with GCC 4.3.1, we
stumbled over some bugs and warnings. We fixed them inhouse by patching
the mico source, being unaware that some of them were already fixed in
darcs HEAD.
The first issue were lots of warnings about deprecated casts of string
literals to char*, all of those seem fixed in mico head.
Some other issue are the strict alias warnings, which are worked-around
with -fno-strict-aliasing both inhouse and in darcs HEAD. As this is
only a workaround which also disables some optimizations, we intend to
"really" fix those issues, but I can't give any promise or timeline.
Also, I don't know whether someone else is working on this issue.
The next one was the issue in idl/codegen-midl.cc where insert_guid()
was writing into a string constant. The fix you provided in HEAD seems
to look like a memory leak to me, as the string should be freed with
CORBA::string_free() at the end.
We had a different fix for that, which also has the advantage that it
does allocate the buffer on the stack which is cheaper on most
platforms. (Patch against HEAD)
diff -rN -u old-head/idl/codegen-midl.cc new-head/idl/codegen-midl.cc
--- old-head/idl/codegen-midl.cc 2008-07-08 11:08:16.179497000 +0200
+++ new-head/idl/codegen-midl.cc 2008-07-08 11:08:18.419637000 +0200
@@ -1604,7 +1604,7 @@
void CodeGenMIDL::insert_guid()
{
- char* szGUID = CORBA::string_dup("(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)");
+ char szGUID[39] = "(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)";
#if defined(_WIN32) && !defined(__MINGW32__)
GUID g;
Another issue was a missing include[1]. "throw.h" uses strcmp() without
including <string.h>.
diff -rN -u old-head/include/mico/throw.h new-head/include/mico/throw.h
--- old-head/include/mico/throw.h 2008-07-08 11:08:16.443513500 +0200
+++ new-head/include/mico/throw.h 2008-07-08 11:08:19.207686250 +0200
@@ -25,7 +25,7 @@
#define __mico_throw_h__
#include <stdarg.h>
-
+#include <string.h>
#ifdef HAVE_EXCEPTIONS
#define MICO_CATCHANY(x) try { x; } catch (...) {}
The last one for now is an exception declaration problem. Unless I
messed up something here, it seems that only HEAD is affected, and not
the stable release. I had a quick fix to make it compile, but I think
that the real problem is a misdetection of HAVE_FINITE_PROTO.
/usr/include/bits/mathcalls.h:205: error: declaration of ‘int finite(double) throw ()’ throws different exceptions
../include/mico/util.h:222: error: from previous declaration ‘int finite(double)’
The ugly, broken quick fix is:
diff -rN -u old-head/include/mico/util.h new-head/include/mico/util.h
--- old-head/include/mico/util.h 2008-07-08 11:08:16.447513750 +0200
+++ new-head/include/mico/util.h 2008-07-08 11:08:19.211686500 +0200
@@ -219,7 +219,7 @@
#endif
#ifndef HAVE_FINITE_PROTO
-extern "C" int finite (double);
+extern "C" int finite (double) throw();
#endif
#ifndef HAVE_FTIME_PROTO
As I have no clue of that autoconf stuff, I'm not sure yet whether the
problem is on my side in my environments here.
There are still some few warnings I'll investigate and bring up in a
later email.
Thanks for your patience and your great work,
Markus
Footnotes:
[1] One of the changes of either newer GCC/listdc++ or newer glibc
against older versions seems that they removed some implicit includes.
In earlier versions of the standard library, some headers
"accidentally" included other headers, so code that missed some
#include-directives actually compiled. Also, incidentally including the
missing header directly (or indirectly) in your own code before the
broken header "hides" the missing include, so such bugs can linger in
the code for decades before being noticed.
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org