calls: false unresolved-site note for macro calls inside a dropped outer argument

Open
#192 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
devtools

Research direction

Read the change documented in commit 0ef7d7a and trace the live-site list shared by calls and callchain, including how it handles scope and preprocessing. Reproduce the case with the provided drop.h and user.c example, then check where an enclosing macro drops an argument slot. Done means calls EXPR stays silent about an unresolved site when its only live site is inside that dropped argument.

Written by the indexing model from the issue text.

Description

In calls <MACRO>, a macro invocation inside an argument discarded by an enclosing macro still triggers the === Via Macros === unresolved-site warning, even though its actual resolves to a function name and the call is never expanded.

Reproducer

// drop.h
#define EXPR(f, x) f(x)
#define DROP(a) 0
int target(int v);

// user.c
#include "drop.h"
int target(int v) { return v; }
int duser(int v) { return DROP(EXPR(target, 1)); }

Querying calls EXPR prints === Via Macros === with the unresolved-site note (the index can reduce to a function name) instead of staying silent.

Cause

Introduced and documented in 0ef7d7a: the live-site list behind the warning checks scope and preprocessing, but does not check whether an enclosing macro drops the argument slot. Because that list is shared with callchain, the slot-drop check needs to live there rather than only in calls.

Expected behavior

calls EXPR should not emit a === Via Macros === unresolved-site warning when the only live site is inside a dropped outer macro argument.

Dominant language
Rust
Stars
187
Forks
53
Avg merge
1d 9h
Merged PRs (30d)
79

Getting set up

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.

More from facebookexperimental/semcode

All issues in facebookexperimental/semcode

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.