anilgkts / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Function prototypes not generated for variable argument functions #992

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make new Arduino project having a main file and additional ".ino" file.

2. Into additional ".ino" file insert a function definition having C style 
variable arguments.
void nice_func(const char *fmt, ...) 
{
  // do nothing
}

3. Now insert call to that function into main file. For example inside
loop function:
void loop()
{  
  nice_func("test", 1);
}

During compilation of the whole project Arduino gives error that
'nice_func' was not declared in this scope.

When we peek into temporary build directory then we can see that Arduino is not 
inserting that function prototype definition into final .cpp file.

For example if you change inside additional ".ino" file this function 
definition to:
void nice_func(const char *fmt, int i)
{
  // do nothing
}
and now it'll compile without errors.

It seems that file building functionality (part that is inserting prototype 
definitions)
inside Arduino is skipping functions having "..." inside arguments area.

I'm using Arduino 1.0.1 on WinXP x64.

Original issue reported on code.google.com by janar.s...@gmail.com on 27 Jul 2012 at 5:08

GoogleCodeExporter commented 9 years ago
This is a limitation of the current Arduino pre-processor; patches welcome.  
Related are issue 188 and issue 386.  One workaround that will be available in 
Arduino 1.0.2 is including the function prototypes yourself (issue 973).  

Original comment by dmel...@gmail.com on 31 Jul 2012 at 12:37

GoogleCodeExporter commented 9 years ago
Please checkout this thread [1] on devs mailing list and try one of the linked 
IDEs. It should fix the problems reported in this issue
[1] https://groups.google.com/a/arduino.cc/forum/#!topic/developers/4X2T3rCxXWM

Original comment by federico...@gmail.com on 21 Jan 2015 at 10:04

GoogleCodeExporter commented 9 years ago

Original comment by federico...@gmail.com on 26 May 2015 at 3:27