{"action":"opened","issue":{"url":"https://api.github.com/repos/platformio/platformio/issues/801","repository_url":"https://api.github.com/repos/platformio/platformio","labels_url":"https://api.github.com/repos/platformio/platformio/issues/801/labels{/name}","comments_url":"https://api.github.com/repos/platformio/platformio/issues/801/comments","events_url":"https://api.github.com/repos/platformio/platformio/issues/801/events","html_url":"https://github.com/platformio/platformio/issues/801","id":181791371,"number":801,"title":"ignored macros #ifdef","user":{"login":"St007","id":5739480,"avatar_url":"https://avatars.githubusercontent.com/u/5739480?v=3","gravatar_id":"","url":"https://api.github.com/users/St007","html_url":"https://github.com/St007","followers_url":"https://api.github.com/users/St007/followers","following_url":"https://api.github.com/users/St007/following{/other_user}","gists_url":"https://api.github.com/users/St007/gists{/gist_id}","starred_url":"https://api.github.com/users/St007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/St007/subscriptions","organizations_url":"https://api.github.com/users/St007/orgs","repos_url":"https://api.github.com/users/St007/repos","events_url":"https://api.github.com/users/St007/events{/privacy}","received_events_url":"https://api.github.com/users/St007/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-08T00:11:52Z","updated_at":"2016-10-08T00:11:52Z","closed_at":null,"body":"When I tried to compile project for  Digispark (Attiny85) it fails with errors about not defined SPI registers. It is true, Attiny85 does not have SPI, but somehow platformio decides took it and create folder SPI in .pioenvs\r\n\r\nI found why this happens ( but it must not happen ! ) . The bug that there is some includes of SPI.h but they are not active (paced in #ifdef section). Platformio includes all that can be found also if it actually not included after processing macros. Temporary solved by manually deleting of all includes of SPI.h and only then project was compiled.\r\nHere is defined RH_PLATFORM_ATTINY and no SPI definitions must be included, but platformio thinks in different way. (Forgive me I'm saying Platformio, for end-user it is like Platformio bug)\r\n\r\n**RadioHead.h**\r\n```cpp\r\n\r\n#ifndef RadioHead_h\r\n#define RadioHead_h\r\n\r\n// Official version numbers are maintained automatically by Makefile:\r\n#define RH_VERSION_MAJOR 1\r\n#define RH_VERSION_MINOR 61\r\n\r\n// Symbolic names for currently supported platform types\r\n#define RH_PLATFORM_ARDUINO          1\r\n#define RH_PLATFORM_MSP430           2\r\n#define RH_PLATFORM_STM32            3\r\n#define RH_PLATFORM_GENERIC_AVR8     4\r\n#define RH_PLATFORM_UNO32            5\r\n#define RH_PLATFORM_UNIX             6\r\n#define RH_PLATFORM_STM32STD         7\r\n#define RH_PLATFORM_STM32F4_HAL      8 \r\n#define RH_PLATFORM_RASPI            9\r\n#define RH_PLATFORM_NRF51            10\r\n#define RH_PLATFORM_ESP8266          11\r\n#define RH_PLATFORM_STM32F2          12\r\n#define RH_PLATFORM_CHIPKIT_CORE     13\r\n\r\n////////////////////////////////////////////////////\r\n// Select platform automatically, if possible\r\n#ifndef RH_PLATFORM\r\n #if (MPIDE>=150 && defined(ARDUINO))\r\n  // Using ChipKIT Core on Arduino IDE\r\n  #define RH_PLATFORM RH_PLATFORM_CHIPKIT_CORE\r\n #elif defined(MPIDE)\r\n  // Uno32 under old MPIDE, which has been discontinued:\r\n  #define RH_PLATFORM RH_PLATFORM_UNO32\r\n #elif defined(NRF51)\r\n  #define RH_PLATFORM RH_PLATFORM_NRF51\r\n #elif defined(ESP8266)\r\n  #define RH_PLATFORM RH_PLATFORM_ESP8266\r\n #elif defined(ARDUINO)\r\n  #define RH_PLATFORM RH_PLATFORM_ARDUINO\r\n #elif defined(__MSP430G2452__) || defined(__MSP430G2553__)\r\n  #define RH_PLATFORM RH_PLATFORM_MSP430\r\n #elif defined(MCU_STM32F103RE)\r\n  #define RH_PLATFORM RH_PLATFORM_STM32\r\n #elif defined(STM32F2XX)\r\n  #define RH_PLATFORM RH_PLATFORM_STM32F2\r\n #elif defined(USE_STDPERIPH_DRIVER)\r\n  #define RH_PLATFORM RH_PLATFORM_STM32STD\r\n #elif defined(RASPBERRY_PI)\r\n  #define RH_PLATFORM RH_PLATFORM_RASPI\r\n#elif defined(__unix__) // Linux\r\n  #define RH_PLATFORM RH_PLATFORM_UNIX\r\n#elif defined(__APPLE__) // OSX\r\n  #define RH_PLATFORM RH_PLATFORM_UNIX\r\n #else\r\n  #error Platform not defined! \t\r\n #endif\r\n#endif\r\n\r\n#if defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtinyX4__) || defined(__AVR_ATtinyX5__) || defined(__AVR_ATtiny2313__) || defined(__AVR_ATtiny4313__) || defined(__AVR_ATtinyX313__)\r\n #define RH_PLATFORM_ATTINY\r\n#endif\r\n\r\n////////////////////////////////////////////////////\r\n// Platform specific headers:\r\n#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)\r\n #if (ARDUINO >= 100)\r\n  #include <Arduino.h>\r\n #else\r\n  #include <wiring.h>\r\n #endif\r\n #ifdef RH_PLATFORM_ATTINY\r\n  #warning Arduino TinyCore does not support hardware SPI. Use software SPI instead.\r\n #else\r\n  #include <SPI.h>\r\n  #define RH_HAVE_HARDWARE_SPI\r\n  #define RH_HAVE_SERIAL\r\n #endif\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_ESP8266) // ESP8266 processor on Arduino IDE\r\n #include <Arduino.h>\r\n #include <SPI.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n #define RH_HAVE_SERIAL\r\n#elif (RH_PLATFORM == RH_PLATFORM_MSP430) // LaunchPad specific\r\n #include \"legacymsp430.h\"\r\n #include \"Energia.h\"\r\n #include <SPI.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n #define RH_HAVE_SERIAL\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_UNO32 || RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)\r\n #include <WProgram.h>\r\n #include <string.h>\r\n #include <SPI.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n #define memcpy_P memcpy\r\n #define RH_HAVE_SERIAL\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_STM32) // Maple, Flymaple etc\r\n #include <wirish.h>\t\r\n #include <stdint.h>\r\n #include <string.h>\r\n #include <HardwareSPI.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n // Defines which timer to use on Maple\r\n #define MAPLE_TIMER 1\r\n #define PROGMEM\r\n #define memcpy_P memcpy\r\n #define Serial SerialUSB\r\n #define RH_HAVE_SERIAL\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_STM32F2) // Particle Photon with firmware-develop\r\n #include <stm32f2xx.h>\r\n #include <application.h>\r\n #include <math.h> // floor\r\n #define RH_HAVE_SERIAL\r\n #define RH_HAVE_HARDWARE_SPI\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_STM32STD) // STM32 with STM32F4xx_StdPeriph_Driver \r\n #include <stm32f4xx.h>\r\n #include <wirish.h>\t\r\n #include <stdint.h>\r\n #include <string.h>\r\n #include <math.h>\r\n #include <HardwareSPI.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n #define Serial SerialUSB\r\n #define RH_HAVE_SERIAL\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_GENERIC_AVR8) \r\n #include <avr/io.h>\r\n #include <avr/interrupt.h>\r\n #include <util/delay.h>\r\n #include <string.h>\r\n #include <stdbool.h>\r\n #define RH_HAVE_HARDWARE_SPI\r\n #include <SPI.h>\r\n\r\n// For Steve Childress port to ARM M4 w/CMSIS with STM's Hardware Abstraction lib. \r\n// See ArduinoWorkarounds.h (not supplied)\r\n#elif (RH_PLATFORM == RH_PLATFORM_STM32F4_HAL) \r\n #include <ArduinoWorkarounds.h>\r\n #include <stm32f4xx.h> // Also using ST's CubeMX to generate I/O and CPU setup source code for IAR/EWARM, not GCC ARM.\r\n #include <stdint.h>\r\n #include <string.h>\r\n #include <math.h>\r\n #define RH_HAVE_HARDWARE_SPI // using HAL (Hardware Abstraction Libraries from ST along with CMSIS, not arduino libs or pins concept.\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_RASPI)\r\n #define RH_HAVE_HARDWARE_SPI\r\n #define RH_HAVE_SERIAL\r\n #define PROGMEM\r\n #include <RHutil/RasPi.h>\r\n #include <string.h>\r\n //Define SS for CS0 or pin 24\r\n #define SS 8\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_NRF51)\r\n #define RH_HAVE_SERIAL\r\n #define PROGMEM\r\n  #include <Arduino.h>\r\n\r\n#elif (RH_PLATFORM == RH_PLATFORM_UNIX) \r\n // Simulate the sketch on Linux and OSX\r\n #include <RHutil/simulator.h>\r\n #define RH_HAVE_SERIAL\r\n#include <netinet/in.h> // For htons and friends\r\n\r\n#else\r\n #error Platform unknown!\r\n#endif\r\n\r\n////////////////////////////////////////////////////\r\n// This is an attempt to make a portable atomic block\r\n#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)\r\n#if defined(__arm__)\r\n  #include <RHutil/atomic.h>\r\n #else\r\n  #include <util/atomic.h>\r\n #endif\r\n #define ATOMIC_BLOCK_START     ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {\r\n #define ATOMIC_BLOCK_END }\r\n#elif (RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)\r\n // UsingChipKIT Core on Arduino IDE\r\n #define ATOMIC_BLOCK_START unsigned int __status = disableInterrupts(); {\r\n #define ATOMIC_BLOCK_END } restoreInterrupts(__status);\r\n#elif (RH_PLATFORM == RH_PLATFORM_UNO32)\r\n // Under old MPIDE, which has been discontinued:\r\n #include <peripheral/int.h>\r\n #define ATOMIC_BLOCK_START unsigned int __status = INTDisableInterrupts(); {\r\n #define ATOMIC_BLOCK_END } INTRestoreInterrupts(__status);\r\n#elif (RH_PLATFORM == RH_PLATFORM_STM32F2) // Particle Photon with firmware-develop\r\n #define ATOMIC_BLOCK_START { int __prev = HAL_disable_irq();\r\n #define ATOMIC_BLOCK_END  HAL_enable_irq(__prev); }\r\n#elif (RH_PLATFORM == RH_PLATFORM_ESP8266)\r\n// See hardware/esp8266/2.0.0/cores/esp8266/Arduino.h\r\n #define ATOMIC_BLOCK_START { uint32_t __savedPS = xt_rsil(15);\r\n #define ATOMIC_BLOCK_END xt_wsr_ps(__savedPS);}\r\n#else \r\n // TO BE DONE:\r\n #define ATOMIC_BLOCK_START\r\n #define ATOMIC_BLOCK_END\r\n#endif\r\n\r\n////////////////////////////////////////////////////\r\n// Try to be compatible with systems that support yield() and multitasking\r\n// instead of spin-loops\r\n// Recent Arduino IDE or Teensy 3 has yield()\r\n#if (RH_PLATFORM == RH_PLATFORM_ARDUINO && ARDUINO >= 155 && !defined(RH_PLATFORM_ATTINY)) || (TEENSYDUINO && defined(__MK20DX128__))\r\n #define YIELD yield();\r\n#elif (RH_PLATFORM == RH_PLATFORM_ESP8266)\r\n// ESP8266 also hash it\r\n #define YIELD yield();\r\n#else\r\n #define YIELD\r\n#endif\r\n\r\n////////////////////////////////////////////////////\r\n// digitalPinToInterrupt is not available prior to Arduino 1.5.6 and 1.0.6\r\n// See http://arduino.cc/en/Reference/attachInterrupt\r\n#ifndef NOT_AN_INTERRUPT\r\n #define NOT_AN_INTERRUPT -1\r\n#endif\r\n#ifndef digitalPinToInterrupt\r\n #if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && !defined(__arm__)\r\n\r\n  #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)\r\n   // Arduino Mega, Mega ADK, Mega Pro\r\n   // 2->0, 3->1, 21->2, 20->3, 19->4, 18->5\r\n   #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT)))\r\n\r\n  #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \r\n   // Arduino 1284 and 1284P - See Manicbug and Optiboot\r\n   // 10->0, 11->1, 2->2\r\n   #define digitalPinToInterrupt(p) ((p) == 10 ? 0 : ((p) == 11 ? 1 : ((p) == 2 ? 2 : NOT_AN_INTERRUPT)))\r\n\r\n  #elif defined(__AVR_ATmega32U4__)\r\n   // Leonardo, Yun, Micro, Pro Micro, Flora, Esplora\r\n   // 3->0, 2->1, 0->2, 1->3, 7->4\r\n   #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))\r\n\r\n  #else\r\n   // All other arduino except Due:\r\n   // Serial Arduino, Extreme, NG, BT, Uno, Diecimila, Duemilanove, Nano, Menta, Pro, Mini 04, Fio, LilyPad, Ethernet etc\r\n   // 2->0, 3->1\r\n   #define digitalPinToInterrupt(p)  ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))\r\n\r\n  #endif\r\n  \r\n #elif (RH_PLATFORM == RH_PLATFORM_UNO32) || (RH_PLATFORM == RH_PLATFORM_CHIPKIT_CORE)\r\n  // Hmmm, this is correct for Uno32, but what about other boards on ChipKIT Core?\r\n  #define digitalPinToInterrupt(p) ((p) == 38 ? 0 : ((p) == 2 ? 1 : ((p) == 7 ? 2 : ((p) == 8 ? 3 : ((p) == 735 ? 4 : NOT_AN_INTERRUPT)))))\r\n\r\n #else\r\n  // Everything else (including Due and Teensy) interrupt number the same as the interrupt pin number\r\n  #define digitalPinToInterrupt(p) (p)\r\n #endif\r\n#endif\r\n\r\n// On some platforms, attachInterrupt() takes a pin number, not an interrupt number\r\n#if (RH_PLATFORM == RH_PLATFORM_ARDUINO) && defined (__arm__) && (defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAM_DUE))\r\n #define RH_ATTACHINTERRUPT_TAKES_PIN_NUMBER\r\n#endif\r\n\r\n// Slave select pin, some platforms such as ATTiny do not define it.\r\n#ifndef SS\r\n #define SS 10\r\n#endif\r\n\r\n// These defs cause trouble on some versions of Arduino\r\n#undef abs\r\n#undef round\r\n#undef double\r\n\r\n// Sigh: there is no widespread adoption of htons and friends in the base code, only in some WiFi headers etc\r\n// that have a lot of excess baggage\r\n#if RH_PLATFORM != RH_PLATFORM_UNIX && !defined(htons)\r\n// #ifndef htons\r\n// These predefined macros availble on modern GCC compilers\r\n #if   __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__\r\n  // Atmel processors\r\n  #define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )\r\n  #define ntohs(x) htons(x)\r\n  #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \\\r\n                   ((x)<< 8 & 0x00FF0000UL) | \\\r\n                   ((x)>> 8 & 0x0000FF00UL) | \\\r\n                   ((x)>>24 & 0x000000FFUL) )\r\n  #define ntohl(x) htonl(x)\r\n\r\n #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\r\n  // Others\r\n  #define htons(x) (x)\r\n  #define ntohs(x) (x)\r\n  #define htonl(x) (x)\r\n  #define ntohl(x) (x)\r\n\r\n #else\r\n  #error \"Dont know how to define htons and friends for this processor\" \r\n #endif\r\n#endif\r\n\r\n// This is the address that indicates a broadcast\r\n#define RH_BROADCAST_ADDRESS 0xff\r\n\r\n#endif\r\n\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"St007"}}