Skip to content

Work around incomplete closure input arguments on some platforms#817

Closed
rosenrodt wants to merge 1 commit intoboostorg:developfrom
rosenrodt:fix-closure-argument-cutoff
Closed

Work around incomplete closure input arguments on some platforms#817
rosenrodt wants to merge 1 commit intoboostorg:developfrom
rosenrodt:fix-closure-argument-cutoff

Conversation

@rosenrodt
Copy link
Contributor

This fixes all the kernel compile errors I encountered when running test_closure, one example:

--- build log ---
BC-src-code:6:75: error: use of undeclared identifier 'pi'
 inline float add_two_and_pi(float x, int two, float  p){ return x + two + pi; }
                                                                           ^
1 diagnostic(s) generated.

I encountered this curious case when cross-compiling with the standalone toolchain generated from android NDK. Most tests pass. But closure is among one of the few that fails. It seems like boost::trim() from the main boost library somehow cuts off more character than it should and also leaves a leading whitespace.

two, pi          // original string   
[two,  pi]       // vector after split()

two              // after trim()
int two          // capture_traits<T>::type_name() << " " << variable_name

 p               // after trim(), there is a leading space before 'pi' and 'i' is cut off 
float  p         // capture_traits<T>::type_name() << " " << variable_name

@jszuppe
Copy link
Contributor

jszuppe commented Jan 22, 2019

That's odd that such an old function works incorrectly (boost::trim()). You should report that to https://github.com/boostorg/algorithm.

@coveralls
Copy link

coveralls commented Jan 22, 2019

Coverage Status

Coverage decreased (-0.002%) to 84.017% when pulling 73d978b on rosenrodt:fix-closure-argument-cutoff into 36c8913 on boostorg:develop.

@rosenrodt
Copy link
Contributor Author

Thank @jszuppe. I have opened a ticket here see how this goes boostorg/algorithm#58

on some platforms trim() would cut off function argument names in the CL kernel declaration and therefore breaks custom closures; the functionality is replaced by split() to circumvent this issue
@rosenrodt rosenrodt force-pushed the fix-closure-argument-cutoff branch from eb93c24 to 73d978b Compare February 20, 2019 04:33
@rosenrodt rosenrodt closed this Jul 27, 2020
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