Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation warning: Wno-unused-variable #779

Open
jordanmontt opened this issue Apr 30, 2024 · 0 comments
Open

Compilation warning: Wno-unused-variable #779

jordanmontt opened this issue Apr 30, 2024 · 0 comments
Labels
enhancement New feature or request slang

Comments

@jordanmontt
Copy link
Member

jordanmontt commented Apr 30, 2024

If one removed the warning Wno-unused-variable from the file CMakeLists.txt, at the time of compiling the generated C code, there are hundreds of warnings.

Let's take as an example the method:

genPrimitiveLoadInt32FromBytes
	^ self genPrimitiveLoad: 4 fromBytesWith: [ :sourcePointer |
		cogit MoveM32: 0 r: sourcePointer R: ReceiverResultReg.
		cogit SignExtend32R: ReceiverResultReg R: ReceiverResultReg.
		self genConvertIntegerToSmallIntegerInReg: ReceiverResultReg.
		cogit  ].

When inlininng, The variable sourcePointer becomes not used and it is replaced (see cogitaarch64.c:21349) by Arg1Reg. This is logical since in the Pharo method genPrimitiveLoadInt32FromBytes, the block sourcePointer was called with Arg1Reg.

Possible solution
It will be nice to improve the inlining algorithm of Slang to clean the non used variables. Because fixing this in the Pharo code can be too time-consuming as there are hundreds of warning and some of them, like the one on the example, are not easy to spot nor to fix

@jordanmontt jordanmontt added slang enhancement New feature or request labels Apr 30, 2024
@jordanmontt jordanmontt changed the title Copmpilation warnings: Wno-unused-variable Compilation warning: Wno-unused-variable May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request slang
Projects
None yet
Development

No branches or pull requests

1 participant