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

Work around incomplete closure input arguments on some platforms #817

Closed

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
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