This would do the trick I think: $ gcc -fpreprocessed -dI -E test.c | grep -e "#include" I have not tried with Microchip's compilers based on gcc though. Tamas On Tue, Aug 2, 2011 at 1:13 AM, William "Chops" Westfield w= rote: > Speaking of doing things to C source that involve at least partial > parsing, are there any tools that will do a sort of "partial > preprocessing" of C source code? > > In particular, I'd like to figure out all the files that are #included > from the top-level code, after accounting for comments and such. > A partial pre-processor that would strip comments and conditionally- > compiled (not compiled) sections would be a good start (a FULL pre- > processor would yield more than just the top level of includes, and I > don't want it to actually have to know where those files are. (the > goal is to be able to build a list of include and library paths based > on the top-level includes that the user has typed.)) > > If I have: > > > #define USEFLASHLIB 0 > > #include > > #include "audio.h" > > // #include "futurelibrary.h" > > /* > > * When this is finished, we'll want to use it instead > > #include "otherfuturelib.h> > > */ > > #if USEFLASHLIB > > #include "flashlib.h" > > #else > > #include > > #endif > > I want to get: > > > #include > > #include "audio.h" > > #include > > (It OK if it assumes that none of the conditional compilation symbols > are defined/redefined by the include files. That would be asking too > much...) > > Thanks > Bill W > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .