Skip to content

Solve multiline functions generation #182

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

Merged
merged 12 commits into from
Jun 14, 2017

Conversation

facchinm
Copy link
Member

@facchinm facchinm commented Oct 6, 2016

Fixes #126

@facchinm facchinm force-pushed the problematic_multiline branch from 18ca33e to 75a2be8 Compare November 29, 2016 14:55
@Chris--A
Copy link

Chris--A commented Dec 1, 2016

@facchinm

This new update does not solve the multi line issue.

Code Used

template< typename T >  
T func(T t){
    return t * t;
}

void setup() {
  func( 12.34f );
}

void loop() {}

Sketch Produced

#include <Arduino.h>
#line 1 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"
#line 1 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"

template< typename T >  
#line 3 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"
T func(T t);
#line 17 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"
void setup();
#line 22 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"
void loop();
#line 3 "C:\\Users\\Chris\\Documents\\Arduino\\template_stuff\\template_stuff.ino"
T func(T t){
    return t * t;
}

void setup() {
  func( 12.34f );
}

void loop() {}

I have many more template tests to try, but it failed on the first.

@facchinm
Copy link
Member Author

facchinm commented Dec 1, 2016

ctags is deliberating removing < typename T > from the return type, leaving only template T and bypassing in this way all the multiline code (which searches for exact match). The prototypes being inserted after template< typename T > is instead another, easily solvable problem. I'm trying to solve the ctags issue but it looks REALLY complicated... Thanks for the POC by the way!

@facchinm
Copy link
Member Author

facchinm commented Dec 2, 2016

@Chris--A the latest commit should solve (or better, mitigate) the issue. Since the ctags TEMPLATE bug was already handled (but the code was plainly wrong in case of multiline) all the other proto generation code behaved really strangely. If you could check if it behaves correctly in your setup I'd be really grateful!

@facchinm facchinm changed the title [WIP] Try to solve multiline functions generation Solve multiline functions generation Dec 7, 2016
Invalidating the first element of the slice works better than setting it to zero
@ArduinoBot
Copy link
Contributor

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/arduino-builder/arduino-builder-182.zip

ℹ️ To test this build:

  1. Replace arduino-builder binary (you can find it where you installed the IDE) with the provided one

@Chris--A
Copy link

Oops, forgot to reply. I did try this and it did solve the problem in this issue. Will also try it with #206

facchinm added 2 commits June 14, 2017 11:20
Self note: never use github conflict resolver again
@ArduinoBot
Copy link
Contributor

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/arduino-builder/arduino-builder-182.zip

ℹ️ To test this build:

  1. Replace arduino-builder binary (you can find it where you installed the IDE) with the provided one

@arduino arduino deleted a comment from ArduinoBot Jun 14, 2017
@facchinm facchinm merged commit eae075b into arduino:master Jun 14, 2017
@cmaglie cmaglie deleted the problematic_multiline branch January 11, 2018 10:10
@cmaglie cmaglie added this to the 1.4.0 milestone Sep 10, 2018
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.

4 participants