Skip to content

Microsoft specific handling of variadic macros not supported #843

@Bertk

Description

@Bertk

The sample variadic_macros.cpp from MSDN fails with com.sonar.sslr.api.RecognitionException

#define MACRO(s, ...) printf(s, __VA_ARGS__)

int main() {
    MACRO("hello, world\n");
}

The syntax tree is created for the next code sample but error messages are shown:

#define EMPTY
#define MACRO(s, ...) printf(s, __VA_ARGS__)

int main() {
    MACRO("error\n", EMPTY);  // would cause error C2059, except VC++ 
                              // suppresses the trailing comma
}

e.g.

08:22:26.021 [AWT-EventQueue-0] ERROR CxxPreprocessor - Mismatch: expected ',' got: ')'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions