Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header with only macro definitions are silently processed without leaving a trace in the final preprocessed output. #35

Open
smwikipedia opened this issue Nov 22, 2019 · 1 comment

Comments

@smwikipedia
Copy link

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:

#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.

I compared it to the result of gcc, I run gccc -E a.c > gcc.pp.a.c, the result is:

# 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.

@smwikipedia smwikipedia changed the title Header with only macro definitions are silently processed without leaving a trace in the final preprocessed output. Header with only macro definitions are silently processed implicitly without leaving a trace in the final preprocessed output. Nov 22, 2019
@smwikipedia smwikipedia changed the title Header with only macro definitions are silently processed implicitly without leaving a trace in the final preprocessed output. Header with only macro definitions are silently processed without leaving a trace in the final preprocessed output. Nov 22, 2019
@ned14
Copy link
Owner

ned14 commented Dec 16, 2019

I've had a few people complain about this, even though this behaviour is perfectly standards conforming. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants