Skip to content

unusedArgs: bring InstructionAPI into scope itself - #70

Merged
bbiiggppiigg merged 1 commit into
masterfrom
bbiiggppiigg/unusedArgs-instructionapi
Nov 23, 2026
Merged

bbiiggppiigg merged 1 commit into
masterfrom
bbiiggppiigg/unusedArgs-instructionapi

Conversation

@bbiiggppiigg

@bbiiggppiigg bbiiggppiigg commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

How we found it

dyninst/dyninst#2629 removes the global-scope using-directives from Dyninst's installed headers. Built against that install, this repository fails in one file:

unusedArgs/unusedArgs.C:74:5: error: 'Instruction' was not declared in this scope; did you mean 'Dyninst::InstructionAPI::Instruction'?

What is wrong

unusedArgs.C uses Instruction unqualified, but it never brings Dyninst::InstructionAPI into scope itself. It compiles today only because the installed liveness.h has using namespace Dyninst::InstructionAPI; at global scope.

How we fixed it

Add using namespace InstructionAPI; next to the file's other using-directives. The change is backward-compatible: the file builds against Dyninst with or without dyninst/dyninst#2629, so this can merge first.

The only other example that includes one of the affected headers, dataflowAPI/liveness.cpp, already builds against dyninst/dyninst#2629.

Validation

On 294a709, all 50 targets built on mahir (x86_64, gcc), with 0 errors and 0 warnings:

Not built on aarch64 or ppc64le; the change has no architecture-specific part.

🤖 Generated with Claude Code

unusedArgs.C uses Instruction unqualified. It only compiles because
Dyninst's installed liveness.h has "using namespace
Dyninst::InstructionAPI;" at global scope. dyninst/dyninst#2629
removes the using-directives from the installed headers, and with it
this file fails to build:

  unusedArgs.C:74:5: error: 'Instruction' was not declared in this scope

Add the using-directive here, next to the file's other ones. It
compiles against Dyninst with or without that change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hainest

hainest commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

I would prefer to not perpetuate using directives as we're doing in dyninst/dyninst#2629.

@bbiiggppiigg

Copy link
Copy Markdown
Member Author

I would prefer to not perpetuate using directives as we're doing in dyninst/dyninst#2629.

I mean this is in .C file so I think it is fine?

@hainest

hainest commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

I would prefer to not perpetuate using directives as we're doing in dyninst/dyninst#2629.

I mean this is in .C file so I think it is fine?

It's far less bad than in headers, but still not as clear as using explicit namespace prefixes. I guess this PR is fine, but it's a background task I'll add for myself for the non-core repos.

@bbiiggppiigg
bbiiggppiigg merged commit ea4c92a into master Nov 23, 2026
1 check passed
@bbiiggppiigg bbiiggppiigg changed the title unusedArgs: bring InstructionAPI into scope itself Don't rely on names leaked by Dyninst's installed headers Nov 23, 2026
@bbiiggppiigg bbiiggppiigg changed the title Don't rely on names leaked by Dyninst's installed headers unusedArgs: bring InstructionAPI into scope itself Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants