Open smwikipedia opened 5 years ago
I tried with 4 files as below:
Folder structure:
C:\MISC\PCPP.TEST a.c h1.h h2.h h3.h
(a.c)
#include "h1.h" #include "h2.h" #ifdef H3 #include "h3.h" #endif void main() { }
(h1.h)
void f_h1() { }
(h2.h)
#define H3
(h3.h)
void f_h3() { }
Then I run pcpp a.c > pp.a.c, the result is:
pcpp a.c > pp.a.c
#line 1 "h1.h" void f_h1() { } #line 1 "h3.h" void f_h3() { } #line 8 "a.c" void main() { }
We can see, the macro H3 defined in h2.h is effective. But there's no trace of h2.h being processed in the final ouput pp.a.c file.
H3
h2.h
pp.a.c
I compared it to the result of gcc, I run gccc -E a.c > gcc.pp.a.c, the result is:
gcc
gccc -E a.c > gcc.pp.a.c
# 1 "a.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "a.c" # 1 "h1.h" 1 void f_h1() { } # 2 "a.c" 2 # 1 "h2.h" 1 <================= HERE, the processing of h2.h is shown. # 3 "a.c" 2 # 1 "h3.h" 1 void f_h3() { } # 6 "a.c" 2 void main() { }
So I think maybe it is nice for pcpp to be more explicit to list the h2.h in the final output.
pcpp
I've had a few people complain about this, even though this behaviour is perfectly standards conforming. I'll look into it.
I tried with 4 files as below:
Folder structure:
(a.c)
(h1.h)
(h2.h)
(h3.h)
Then I run
pcpp a.c > pp.a.c
, the result is:We can see, the macro
H3
defined inh2.h
is effective. But there's no trace ofh2.h
being processed in the final ouputpp.a.c
file.I compared it to the result of
gcc
, I rungccc -E a.c > gcc.pp.a.c
, the result is:So I think maybe it is nice for
pcpp
to be more explicit to list theh2.h
in the final output.