ned14 / pcpp

A C99 preprocessor written in pure Python
Other
220 stars 41 forks source link

#line directive not output for first include #17

Closed Sei-Lisa closed 5 years ago

Sei-Lisa commented 5 years ago

Say this is test.c (I fed it into stdin, so the actual name should not matter; the bug can be reproduced either way anyway):

#include "inc.h"
test1
#include "inc.h"
test2

and this is inc.h:

inc1
#ifndef __inc_h__
inc2
#define __inc_h__
inc3
#endif //__inc_h__
inc4

The output from the above is:

inc1

inc2

inc3

inc4
#line 2 "<stdin>"
test1
#line 1 "inc1.h"
inc1

inc4
#line 4 "<stdin>"
test2

Note the absence of any indication that the first appearances of inc1, inc2, inc3 and inc4 come from inc.h.

ned14 commented 5 years ago

Thanks for the report. I am currently on vacation in the United States. Due to lack of computing devices, I cannot verify nor fix this BR, but I shall do so when I return to Europe in about ten days time.

ned14 commented 5 years ago

Fixed. Thanks for the bug report!