Skip to content

debugability: macro metaprogramming: vararg counter returns 0 when token start with parenthesis #542

Closed

Description

@mwierzbix

Following macros:

  1. META_COUNT_VARAGS_BEFORE_COMPILE()
  2. META_COUNT_VARAGS_BEFORE_COMPILE(A)
  3. META_COUNT_VARAGS_BEFORE_COMPILE(1,2,3)
  4. META_COUNT_VARAGS_BEFORE_COMPILE((1+2)<<2)
  5. META_COUNT_VARAGS_BEFORE_COMPILE(2*(1+2))

should expand to:

  1. 0
  2. 1
  3. 3
  4. 1
  5. 1

but currently they expand to:

  1. 0
  2. 1
  3. 3
  4. 0
  5. 1

This, combined with _TRACE_EVENT_NTH in BASE_LOG in trace.h will break FW during any calls to _trace_event(..., (x+y)<<z , ...) in runtime (so no compiler warnings).

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

Metadata

Metadata

Assignees

Labels

P1Blocker bugs or important featuresbugSomething isn't working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions