Skip to content

parse error in cpp when including a file specified by a preprocessing token #37

@dashea

Description

@dashea

For instance, given the following source file:

#ifdef HELLO_H                                                                                                          
#include HELLO_H                                                                                                        
#endif                                                                                                                  
                                                                                                                        
int main(void)                                                                                                          
{                                                                                                                       
    return 0;                                                                                                           
}

And an empty hello.h, running pcc -DHELLO_H=\"hello.h\" hello.c results in:

hello.h:8: error: unterminated conditional
error: /usr/local/libexec/cpp terminated with status 1

In the first run of fastscan() on hello.h, the first call to qcchar() resets to inp to linp, which at that point is set to the line in the original source file after #include HELLO_H, so it ends up processing the #endif in the context of hello.h and bombing out. I apologize that I don't have a fix for this, but hopefully this information helps.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions