Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with __has_include(<...>) and ICCAVR #592

Closed
dhebbeker opened this issue Sep 6, 2022 · 1 comment · Fixed by #593
Closed

Issue with __has_include(<...>) and ICCAVR #592

dhebbeker opened this issue Sep 6, 2022 · 1 comment · Fixed by #593

Comments

@dhebbeker
Copy link
Contributor

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:

 include/etl/placement_new.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/etl/placement_new.h b/include/etl/placement_new.h
index 882d8704..3efaffb9 100644
--- a/include/etl/placement_new.h
+++ b/include/etl/placement_new.h
@@ -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
@jwellbelove
Copy link
Contributor

Fixed 20.34.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants