microsoft / microsoft/CLOG

Stub clog causes unused variable errors if the variables are only used in logs

Open
#79 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
C#
Stars
36
Forks
15
Avg merge
1d 5m
Merged PRs (30d)
1

Description

inline
void
QuicTraceEventStubVarArgs(
    _In_ const void* Fmt,
    ...
    )
{
    UNREFERENCED_PARAMETER(Fmt);
}
#define QuicTraceEvent(Name, ...) QuicTraceEventStubVarArgs("", __VA_ARGS__)

In msquic, we use the following trick to make sure the compiler sees all logs as referenced, rather then just defining away the macro.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the QuicTraceEventStubVarArgs definition and the QuicTraceEvent macro shown in the issue, then inspect how CLOG emits or uses this stub when logging is disabled. Verify the change with a compilation case where variables are referenced only through logging, and consider the work done when that case no longer produces unused-variable errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.