Bad behaviour: macro __FILE__ returns wrong tab name (IDE 1.6.7)

If you add one or more tabs to your sketch called "whatsoever.ino" and declare at least one function in that tab the FILE macro will no longer return the filename of your main file (the one with the setup and loop) but the name of the tab that is last in the alphabet, no matter if you are calling the declared function or not. (In 1.6.5 this was not the case.) The main file:

void setup() {
  Serial.begin(9600);
  Serial.println(__FILE__);
}
void loop() {}

The tab.ino:

int dummy() {
  return 0;
}

Good catch. This can also cause the compiler error/warning and error highlight to specify the wrong filename. I have reported the issue here: https://github.com/arduino/arduino-builder/issues/99

Well it sounds like this bug could take a while to get fixed so until then the workaround is to manually declare function prototypes. So in your example you would need to change the main file to:

int dummy();
void setup() {
  Serial.begin(9600);
  Serial.println(__FILE__);
}
void loop() {}

Thanks, @pert! Yes, declaring prototypes solved the problem. But its really a WORK-around to add some 50 function declarations (thanks to copy-and-paste). If you mistype any of them you will get strange error messages. And if you use parameters of types like File or IPAddress you have to #include the appropriate libraries before. Actually, it is more easy to retain a previous version of the IDE :-) until 1.6.8 is available.