[omniORB] omniidl assert error about comments after upgrade from 2.8 to 3

Richard Gruet rgruet@ina.fr
Thu, 16 Mar 2000 19:42:59 +0100


--------------9AF5B59A23DDA0FA795BCC70
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

OK, thank you.

There is another issue about comments and the -k option.  Following the
Javadoc convention, I use to put them BEFORE the objects they describe,
whereas you follow the opposite convention in idlast.py.
How could I manage that ? Could you make it an option (a k sub-option?
beware, you'll lack option letters soon)

And finally, a suggestion:
It'd be nice if you could catch the exceptions when calling the back-ends
(in main.py, line #400: bemodules[i].run(tree, backends_args[i])), because
omniidl is silent when a syntax error or other exception occurs in a
back-end, and that makes the debugging more tricky!

Cheers,

Richard Gruet


Duncan Grisby wrote:

> On Thursday 16 March, Richard Gruet wrote:
> >     >omniidl -N -CmyOutDir -bpython
> > d:\Divan2\main\src\INA\idl\DataModel_.idl
> >     Assertion failed: mostRecent_, file idlast.cc, line 128
>
> Oops. Silly mistake. I've added support for passing comments on to the
> back-end, and broke it for the case that keeping comments was turned
> off, but comments appeared in omniidl's input.
>
> Here's a patch which fixes it. It's also in CVS.
>
> Cheers,
>
> Duncan.
>
> diff -u -r1.14.2.2 idlast.cc
> --- src/tool/omniidl/cxx/idlast.cc      2000/03/07 10:31:26     1.14.2.2
> +++ src/tool/omniidl/cxx/idlast.cc      2000/03/16 17:27:07
> @@ -125,13 +125,15 @@
>  Comment::
>  append(const char* commentText)
>  {
> -  assert(mostRecent_);
> -  char* newText = new char[(strlen(mostRecent_->commentText_) +
> -                           strlen(commentText) + 1)];
> -  strcpy(newText, mostRecent_->commentText_);
> -  strcat(newText, commentText);
> -  delete [] mostRecent_->commentText_;
> -  mostRecent_->commentText_ = newText;
> +  if (Config::keepComments) {
> +    assert(mostRecent_);
> +    char* newText = new char[(strlen(mostRecent_->commentText_) +
> +                             strlen(commentText) + 1)];
> +    strcpy(newText, mostRecent_->commentText_);
> +    strcat(newText, commentText);
> +    delete [] mostRecent_->commentText_;
> +    mostRecent_->commentText_ = newText;
> +  }
>  }

--------------9AF5B59A23DDA0FA795BCC70
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
OK, thank you.
<p>There is another issue about comments and the -k option.&nbsp; Following
the Javadoc convention, I use to put them BEFORE the objects they describe,
whereas you follow the opposite convention in idlast.py.
<br>How could I manage that ? Could you make it an option (a k sub-option?
beware, you'll lack option letters soon)
<p>And finally, a suggestion:
<br>It'd be nice if you could catch the exceptions when calling the back-ends
(in main.py, line #400: bemodules[i].run(tree, backends_args[i])), because
omniidl is silent when a syntax error or other exception occurs in a back-end,
and that makes the debugging more tricky!
<p>Cheers,
<p>Richard Gruet
<br>&nbsp;
<p><i>Duncan Grisby wrote:</i>
<blockquote TYPE=CITE><i>On Thursday 16 March, Richard Gruet wrote:</i>
<br><i>>&nbsp;&nbsp;&nbsp;&nbsp; >omniidl -N -CmyOutDir -bpython</i>
<br><i>> d:\Divan2\main\src\INA\idl\DataModel_.idl</i>
<br><i>>&nbsp;&nbsp;&nbsp;&nbsp; Assertion failed: mostRecent_, file idlast.cc,
line 128</i><i></i>
<p><i>Oops. Silly mistake. I've added support for passing comments on to
the</i>
<br><i>back-end, and broke it for the case that keeping comments was turned</i>
<br><i>off, but comments appeared in omniidl's input.</i><i></i>
<p><i>Here's a patch which fixes it. It's also in CVS.</i><i></i>
<p><i>Cheers,</i><i></i>
<p><i>Duncan.</i><i></i>
<p><i>diff -u -r1.14.2.2 idlast.cc</i>
<br><i>--- src/tool/omniidl/cxx/idlast.cc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2000/03/07 10:31:26&nbsp;&nbsp;&nbsp;&nbsp; 1.14.2.2</i>
<br><i>+++ src/tool/omniidl/cxx/idlast.cc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2000/03/16 17:27:07</i>
<br><i>@@ -125,13 +125,15 @@</i>
<br><i>&nbsp;Comment::</i>
<br><i>&nbsp;append(const char* commentText)</i>
<br><i>&nbsp;{</i>
<br><i>-&nbsp; assert(mostRecent_);</i>
<br><i>-&nbsp; char* newText = new char[(strlen(mostRecent_->commentText_)
+</i>
<br><i>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
strlen(commentText) + 1)];</i>
<br><i>-&nbsp; strcpy(newText, mostRecent_->commentText_);</i>
<br><i>-&nbsp; strcat(newText, commentText);</i>
<br><i>-&nbsp; delete [] mostRecent_->commentText_;</i>
<br><i>-&nbsp; mostRecent_->commentText_ = newText;</i>
<br><i>+&nbsp; if (Config::keepComments) {</i>
<br><i>+&nbsp;&nbsp;&nbsp; assert(mostRecent_);</i>
<br><i>+&nbsp;&nbsp;&nbsp; char* newText = new char[(strlen(mostRecent_->commentText_)
+</i>
<br><i>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
strlen(commentText) + 1)];</i>
<br><i>+&nbsp;&nbsp;&nbsp; strcpy(newText, mostRecent_->commentText_);</i>
<br><i>+&nbsp;&nbsp;&nbsp; strcat(newText, commentText);</i>
<br><i>+&nbsp;&nbsp;&nbsp; delete [] mostRecent_->commentText_;</i>
<br><i>+&nbsp;&nbsp;&nbsp; mostRecent_->commentText_ = newText;</i>
<br><i>+&nbsp; }</i>
<br><i>&nbsp;}</i></blockquote>
</html>

--------------9AF5B59A23DDA0FA795BCC70--