Skip to content

Add static linkage to file-local function#8521

Merged
NikolajBjorner merged 3 commits intomasterfrom
copilot/add-static-linkage-functions
Feb 7, 2026
Merged

Add static linkage to file-local function#8521
NikolajBjorner merged 3 commits intomasterfrom
copilot/add-static-linkage-functions

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

One function was defined at file scope but only used within its compilation unit, violating encapsulation and unnecessarily exposing symbols.

Changes

  • throw_invalid_reference() in src/api/z3_replayer.cpp - internal error handling helper

This function now has static linkage, properly scoping it to its translation unit.

// Before
void throw_invalid_reference() { ... }

// After  
static void throw_invalid_reference() { ... }

Notes

Initially identified SetR, SetO, SetAO in api_log.cpp as candidates, but these are declared in the generated header api_log_macros.h and must remain externally visible.

The prexpr() function in src/ast/ast.cpp was initially changed but has been reverted to remain available for debugging purposes across the codebase.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add static linkage to file-local functions Add static linkage to file-local functions Feb 6, 2026
Copilot AI requested a review from nunoplopes February 6, 2026 23:22
src/ast/ast.cpp Outdated
// show an expr_ref on stdout

void prexpr(expr_ref &e){
static void prexpr(expr_ref &e){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot revert this one. It should always be available for debugging. Maybe define it only in debugging mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in eced186. The prexpr function is now non-static and remains available for debugging.

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
Copilot AI changed the title Add static linkage to file-local functions Add static linkage to file-local function Feb 7, 2026
Copilot AI requested a review from nunoplopes February 7, 2026 09:36
@NikolajBjorner NikolajBjorner marked this pull request as ready for review February 7, 2026 13:07
@NikolajBjorner NikolajBjorner merged commit f26f570 into master Feb 7, 2026
30 checks passed
@nunoplopes nunoplopes deleted the copilot/add-static-linkage-functions branch February 7, 2026 13:50
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.

3 participants