Skip to content

Failure when header is included twice with different macros defined #581

Description

@danmar

file1.c:

# define Y
# include "test.h"

# define BBB
# include "test.h"

test.h:

#if defined AAA
#elif defined BBB
# undef BBB
#endif

#ifdef BBB
# error adf
#endif

Output:

$ ~/simplecpp/simplecpp file.c
test.h:8: #error: #error adf

Activity

  1. changed the title [-]Fail to reprocess header, #if conditions should not have the same results[/-] [+]Failure when header is included twice with different macros defined[/+] on Nov 1, 2025
  2. self-assigned this
    on Nov 1, 2025
  3. firewave commented on Nov 1, 2025

    @firewave
    Collaborator

    Oh wow. That is an issue. I considered this when the include handling was reworked and I thought I raised this is the PR and/or tested it. Apparently I did not ...

  4. danmar commented on Nov 1, 2025

    @danmar
    CollaboratorAuthor

    @firewave yeah. please review #582 that fixes this. :-)

  5. added a commit that references this issue on Nov 5, 2025
    e50c48c
  6. added a commit that references this issue on Nov 5, 2025
    7a81c1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions