tinyplasticgreyknight / modern-docs

1 stars 0 forks source link

pycparser expects to receive preprocessed source #10

Open tinyplasticgreyknight opened 9 years ago

tinyplasticgreyknight commented 9 years ago

Currently modern.h has its #include lines stripped off before feeding it to pycparser, but a more correct approach is to actually run cpp over it first.

IreneKnapp commented 9 years ago

It intentionally only includes standard C system headers, nothing else from the project, so for whatever it's worth you aren't breaking anything by stripping them. You definitely don't want the zillions of definitions from the system headers passing through your tool when you can easily filter them out. :)

IreneKnapp commented 9 years ago

Oh - and also there's no #defines or any other preprocessor stuff in modern.h because I didn't see a use for them, given the constraint that any feature I added with the preprocessor I would need to find a way for non-C languages to also use. Obviously internal.h does use cpp, but I definitely think there's no need to implement a cpp pass unless you find it helpful.

tinyplasticgreyknight commented 9 years ago

The reason I ran across this is that I was hoping it would be possible to e.g. have some documentation about the semantics of things in a comment right there in modern.h, then extract it out. That would certainly help stop code and documentation from drifting apart.

But unfortunately it looks like pycparser can't read comments (it expects cpp will have already removed them).

IreneKnapp commented 9 years ago

That would indeed be nice, but it's definitely up to you whether it's worth implementing. It sounds like it would be probably more work than it's worth.