Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Charles Mills
RE: Need help figuring out what goes wrong [ reply ]  
2004-11-03 16:22
Observations/Questions:
- Why does the word INCLUDE appear all capitalized?
not a good reason for that, but because include directives get turned in the an array -> [ :INCLUDE, "file name" ]
That could be improved :)

- the line number is completely wrong. I know this because I see the (partial) output being generated.
OK, that is a bug.

- The two open braces also don't ring a bell.
Yeah, there is only one open brace. The first one your seeing is the type of symbol :)
I should probably take that info out of the error message, or check if the type of symbol == the actual symbol. (Some times the type of symbol gives useful info - like identifier, integer, float, etc)

- is there any possibility to produce a 'stack trace' as with the other errors I found instead of this oneliner?
Best thing to do is comment out the rescue clause on line 274 - 277 in dbcparse.rb.
This may lead you to another rescue clause (which you can comment out) or to the source of the error.

- could it be that the error message prints out incomplete/wrong info? I mean: could the open braces come from a previously parsed line and that those variables are not initialized for this error? (Just wild guessing here)
Yes. The error reporting is not perfect, but it's not bad either :)

You should be able to include a file with a '(' in the name. So the error is probably something else....

So the problem involves multiple inclusions of the same file?

It just hit me what the problem might be:
So the C standard says this should work:
#define FILE "hey.h"
#include FILE

But I just realized I implemented it wrong. So if you do
#define myfile (bunch of stuff)
#include <myfile.h>
DBC for C will expand myfile to (bunch of stuff). Very bad.

I will fix that and hopefully that will fix your problem. I am still interested in the stack trace though. And the issues about the error reporting should probably be addressed.

You should join the mailing list! There are only 2 people on right now, but I think it would be easier to reply to your posts :)

-Charlie

By: Marc Verwerft
Need help figuring out what goes wrong [ reply ]  
2004-11-03 14:42
I'm testing dbc against a project (cause I would like to use it ;-). First step is just to parse everything as is and later on adding contracts.

Setup of the project:
-in a directory I got approx. 50 header files. They are all included in one central header file.
- all the header files are protected against multiple inclusion.
- some header files include the central header file

When parsing the central header file I get this error:
central_header_file.h:52: parse error after 'INCLUDE <' on "(" "("
It happens when the parser reads an include file that includes the central header file.
I've tried other possibilities/combinations of the header files but I always get an error if I try a more or less similar setup with multiple inclusions.

This makes me suspect the include mechanism in dbc, but I can't produce a short example with the same symptoms nor can I find where it goes wrong in dbc. In other words, I'm stuck for now.

Observations/Questions:
- Why does the word INCLUDE appear all capitalized?
- the line number is completely wrong. I know this because I see the (partial) output being generated.
- The two open braces also don't ring a bell.
- is there any possibility to produce a 'stack trace' as with the other errors I found instead of this oneliner?
- could it be that the error message prints out incomplete/wrong info? I mean: could the open braces come from a previously parsed line and that those variables are not initialized for this error? (Just wild guessing here)

The good news is that by rearranging the headers and slightly modifying the code, I can get dbc to produce some valid output. So there has to be a difference in the way gcc handles these multiple inclusions as opposed to dbc.

Any other help is also appreciated ;-)

Marc.