Skip to content

macro expansion is not correctΒ #153

@real-hong

Description

@real-hong
chibicc -E macro.c

will get

BAR() 1

however

gcc -E macro.c

will get

BAR_I ()() 1 1 1
// macro.c
#define EMPTY()
#define DEFER(id) id EMPTY()
#define EXPAND(...) __VA_ARGS__
#define BAR_I() BAR
#define BAR()  DEFER(BAR_I)()() 1
EXPAND(EXPAND(BAR()))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions