Skip to content

Commit

Permalink
Apply workaround for __has_include(<...>) and ICCAVR. (#593)
Browse files Browse the repository at this point in the history
ICCAVR: IAR C/C++ Compiler V6.70.1.929 for Atmel AVR

There seems to be an issue with the ICCAVR compiler and `__has_include(<...>)` syntax:

```
Error[Pe008]: missing closing quote etl\include\etl\placement_new.h 48
Tool Internal Error:
Internal Error: [Front end]: assertion failed at: "..\..\Translator\compiler_core\src\parser\edg\literals.c", line 1159
Internal Error: [Front end]: assertion failed at: "..\..\Translator\compiler_core\src\parser\edg\literals.c", line 1159 etl\include\etl\placement_new.h 48
Error while running C/C++ Compiler
```

Which is weird, as I wonder why `__has_include` is defined in first place. The compiler is supposed to support some dialect of C++98.

Anyhow, `__has_include()` seems to work in general with ICCAVR. And with this change the code compiles well.
  • Loading branch information
dhebbeker authored Sep 7, 2022
1 parent 4b0047a commit 63e3106
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/etl/placement_new.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SOFTWARE.
// Figure out if we can use the standard library <new> header, if haven't already done so in etl_profile.h
#if !defined(ETL_USING_STD_NEW)
#if defined(__has_include)
#define ETL_USING_STD_NEW __has_include(<new>)
#define ETL_USING_STD_NEW __has_include("new")
#elif (defined(ARDUINO) && defined(__AVR__))
#define ETL_USING_STD_NEW 0
#else
Expand Down

0 comments on commit 63e3106

Please sign in to comment.