Skip to content

Comments

Remove unused function declaration NSMakeCollectable#577

Merged
rfm merged 4 commits intognustep:masterfrom
probonopd:patch-1
Feb 20, 2026
Merged

Remove unused function declaration NSMakeCollectable#577
rfm merged 4 commits intognustep:masterfrom
probonopd:patch-1

Conversation

@probonopd
Copy link
Contributor

Without the change, we are getting in Gershwin AssistantFramework:

 Creating GSAssistantFramework.framework/Versions/1/Resources...
 Updating Version/Current symlink...
Making all for framework GSAssistantFramework...
 Compiling file GSAssistantWindow.m ...
 Compiling file GSAssistantSteps.m ...
In file included from GSAssistantWindow.m:8:
In file included from ./GSAssistantFramework.h:8:
In file included from /System/Library/Headers/Foundation/Foundation.h:32:
In file included from /System/Library/Headers/Foundation/FoundationErrors.h:28:
In file included from /System/Library/Headers/Foundation/NSObject.h:31:
/System/Library/Headers/Foundation/NSZone.h:250:48: error: unused parameter 'cf' [-Werror,-Wunused-parameter]
  250 | static inline id NSMakeCollectable(const void *cf) {
      |                                                ^
In file included from GSAssistantSteps.m:8:
In file included from ./GSAssistantFramework.h:8:
In file included from /System/Library/Headers/Foundation/Foundation.h:32:
In file included from /System/Library/Headers/Foundation/FoundationErrors.h:28:
In file included from /System/Library/Headers/Foundation/NSObject.h:31:
/System/Library/Headers/Foundation/NSZone.h:250:48: error: unused parameter 'cf' [-Werror,-Wunused-parameter]
  250 | static inline id NSMakeCollectable(const void *cf) {
      |                                                ^
1 error generated.
make[3]: *** [/System/Library/Makefiles/rules.make:534: obj/GSAssistantFramework.obj/GSAssistantWindow.m.o] Error 1
make[3]: *** Waiting for unfinished jobs....
1 error generated.
make[3]: *** [/System/Library/Makefiles/rules.make:534: obj/GSAssistantFramework.obj/GSAssistantSteps.m.o] Error 1
make[2]: *** [/System/Library/Makefiles/Instance/framework.make:617: internal-framework-run-compile-submake] Error 2
make[1]: *** [/System/Library/Makefiles/Master/rules.make:297: GSAssistantFramework.all.framework.variables] Error 2
make[1]: Leaving directory '/tmp/cirrus-ci-build/repos/gershwin-components/Assistants/AssistantFramework'
make: *** [Makefile:10: system] Error 1
Exit status: 2

https://cirrus-ci.com/task/4869985861894144

Note

I am not sure whether this patch is correct for ARC and non-ARC environments; it does fix the compile error in Gershwin's ARC based code though.

Copilot AI review requested due to automatic review settings February 8, 2026 20:47
@probonopd probonopd requested a review from rfm as a code owner February 8, 2026 20:47
probonopd added a commit to gershwin-desktop/gershwin-build that referenced this pull request Feb 8, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix an ARC build failure caused by -Werror,-Wunused-parameter in NSMakeCollectable within the Foundation headers.

Changes:

  • Removes the static inline id NSMakeCollectable(const void *cf) definition from Headers/Foundation/NSZone.h.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 248 to 252
#endif

static inline id NSMakeCollectable(const void *cf) {
#if __has_feature(objc_arc)
return nil;
#else
return (id)cf; // Unimplemented; garbage collection is deprecated.
#endif
}

#if defined(__cplusplus)
}
#endif
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Removing NSMakeCollectable entirely changes the public Foundation header surface (any downstream code that calls NSMakeCollectable will now fail to compile). The reported issue is specifically the unused parameter warning under ARC; a safer fix is to keep NSMakeCollectable and mark the parameter as intentionally unused in the ARC branch (e.g., via GS_UNUSED_ARG / attribute((unused)) on the parameter, or a (void)cf statement) so the API remains available while silencing -Wunused-parameter.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@rfm rfm left a comment

Choose a reason for hiding this comment

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

While the Copilot comment is correct about this being 'wrong', it doesn't understand the real world. I think this is actually a function declaration which is completely useless (and unused), so removing it is harmless. I understand that it was probably added in order to be formally compatible with OSX, but I'm not convinced that sort of 'compatibility' is valuable.

So, please add a ChangbeLog entry, and then we can merge.

@probonopd
Copy link
Contributor Author

probonopd commented Feb 10, 2026

@rfm thanks, ChangeLog added. Please squash commits when merging.

@probonopd probonopd changed the title Remove unused parameter 'cf' Remove unused function declaration NSMakeCollectable Feb 14, 2026
probonopd added a commit to gershwin-desktop/gershwin-build that referenced this pull request Feb 14, 2026
@pkgdemon
Copy link

@rfm is this PR blocked because of the changeling merge conflict? I was waiting on this as well.

@rfm rfm merged commit a3e9671 into gnustep:master Feb 20, 2026
@rfm
Copy link
Contributor

rfm commented Feb 20, 2026

Sorry, I was unable to resolve the conflict from the github app on my phone; had to get to a desktop system to do it.

@pkgdemon
Copy link

No problem. Thank you. :)

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants