Xmake Version
latest github snapshot
Operating System Version and Architecture
Any
Describe Bug
It seems that there are a couple of places where table.find_if is used with a predicate (anonymous function) that doesn't have a return statement, so it effectively always returns nil.
Here
https://github.com/xmake-io/xmake/blob/4d9a7aeaaf2732ee846ee452f46370a29b6de038/xmake/rules/c%2B%2B/modules/gcc/support.lua#L314C47-L314C95
and here
https://github.com/xmake-io/xmake/blob/4d9a7aeaaf2732ee846ee452f46370a29b6de038/xmake/rules/c%2B%2B/modules/msvc/support.lua#L264C47-L264C95
The Lua 5.5 reference manual says
Results are returned using the return statement (see §3.3.4). If control reaches the end of a function without encountering a return statement, then the function returns with no results.
So this really looks like a bug to me, unless the Lua interpreter used by Xmake has some kind of extension that allows functions to return a value without a return statement.
Expected Behavior
Those two anonymous functions should really have return statements.
Project Configuration
Irrelevant
Additional Information and Error Logs
No additional information.
Xmake Version
latest github snapshot
Operating System Version and Architecture
Any
Describe Bug
It seems that there are a couple of places where
table.find_ifis used with a predicate (anonymous function) that doesn't have areturnstatement, so it effectively always returnsnil.Here
https://github.com/xmake-io/xmake/blob/4d9a7aeaaf2732ee846ee452f46370a29b6de038/xmake/rules/c%2B%2B/modules/gcc/support.lua#L314C47-L314C95
and here
https://github.com/xmake-io/xmake/blob/4d9a7aeaaf2732ee846ee452f46370a29b6de038/xmake/rules/c%2B%2B/modules/msvc/support.lua#L264C47-L264C95
The Lua 5.5 reference manual says
So this really looks like a bug to me, unless the Lua interpreter used by Xmake has some kind of extension that allows functions to return a value without a
returnstatement.Expected Behavior
Those two anonymous functions should really have
returnstatements.Project Configuration
Irrelevant
Additional Information and Error Logs
No additional information.