SPI.cpp includes "pins_arduino.h" unncessarily
The file SPI.cpp includes:
#include "pins_arduino.h"
#include "SPI.h"
However SPI.h includes Arduino.h which includes pins_arduino.h. So this additional include would seem to be unnecessary.
This breaks a compile under certain other boards (eg. Bobuino) because of some clash between C and C++ linkage.
See forum thread: http://arduino.cc/forum/index.php/topic,146968
Example code:
#include <SPI.h>
void setup () { }
void loop () { }
Error message:
In file included from /Applications/Arduino_1.0.3.app/Contents/Resources/Java/libraries/SPI/SPI.h:15,
from /Applications/Arduino_1.0.3.app/Contents/Resources/Java/libraries/SPI/SPI.cpp:12:
/Users/nick/Documents/Arduino/hardware/maniacbug-mighty-1284p/variants/bobuino/pins_arduino.h:38: error: previous declaration of 'const uint8_t digital_pin_to_timer_PGM [32]' with 'C++' linkage
/Users/nick/Documents/Arduino/hardware/maniacbug-mighty-1284p/cores/standard/Arduino.h:133: error: conflicts with new declaration with 'C' linkage
inside all the pins_arduino.h files contained in the different variants folders we use include guards. This prevents problems associated with double inclusions.
Actually I don't know why the #include "pins_arduino.h" was placed inside the SPI.cpp file and I don't want to remove it to prevent problems with backward compatibility. Using the include guards all the Arduino boards compiles as expected, probably in the Bobuino pins_arduino.h file they forgot to use it.