Skip to content

Parser exception when expanding macros of macros #674

@HGuillemet

Description

@HGuillemet
#define X(methodname) \
  void methodname(    \
      int i);

class C {
#define Y X(f)

public:
  Y
};

Parsing this header throws:

Info: Parsing m.h
Exception in thread "main" org.bytedeco.javacpp.tools.ParserException: m.h:6:"#define X(methodname)
  void methodname(
      int i);": Could not parse declaration at ')'
	at org.bytedeco.javacpp.tools.Parser.declarations(Parser.java:4220)

I think this is related to \n in the first macro that are expanded in the second as true \n, making this loop end too soon.

How to fix this ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions