[clang] 892c56e - [clang][AVR] Redefine some types to be compatible with avr-gcc
Ben Shi via cfe-commits
cfe-commits at lists.llvm.org
Wed May 12 07:05:46 PDT 2021
Author: Ben Shi
Date: 2021-05-12T22:05:26+08:00
New Revision: 892c56eabe250acaeb761eaddf783f47d95f7f4d
URL: https://github.com/llvm/llvm-project/commit/892c56eabe250acaeb761eaddf783f47d95f7f4d
DIFF: https://github.com/llvm/llvm-project/commit/892c56eabe250acaeb761eaddf783f47d95f7f4d.diff
LOG: [clang][AVR] Redefine some types to be compatible with avr-gcc
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D100701
Added:
Modified:
clang/lib/Basic/Targets/AVR.cpp
clang/test/CodeGen/builtins.cpp
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/AVR.cpp b/clang/lib/Basic/Targets/AVR.cpp
index e87b7338c4d6..86fda19869a8 100644
--- a/clang/lib/Basic/Targets/AVR.cpp
+++ b/clang/lib/Basic/Targets/AVR.cpp
@@ -309,6 +309,8 @@ void AVRTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__AVR__");
Builder.defineMacro("__ELF__");
Builder.defineMacro("__flash", "__attribute__((address_space(1)))");
+ Builder.defineMacro("__UINT16_TYPE__", "unsigned int");
+ Builder.defineMacro("__INT16_TYPE__", "int");
if (!this->CPU.empty()) {
auto It = llvm::find_if(
diff --git a/clang/test/CodeGen/builtins.cpp b/clang/test/CodeGen/builtins.cpp
index 6ba67ecbfc7e..575a8a11ca5b 100644
--- a/clang/test/CodeGen/builtins.cpp
+++ b/clang/test/CodeGen/builtins.cpp
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -ffreestanding -verify %s
// RUN: %clang_cc1 -std=c++11 -triple i686-pc-linux-gnu -ffreestanding -verify %s
-// RUN: %clang_cc1 -std=c++11 -triple avr-unknown-unknown -ffreestanding -verify %s
// expected-no-diagnostics
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index be60eb6d9cf6..20ab2c05596b 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1942,7 +1942,7 @@
// AVR:#define __GXX_ABI_VERSION 1002
// AVR:#define __INT16_C_SUFFIX__
// AVR:#define __INT16_MAX__ 32767
-// AVR:#define __INT16_TYPE__ short
+// AVR:#define __INT16_TYPE__ int
// AVR:#define __INT32_C_SUFFIX__ L
// AVR:#define __INT32_MAX__ 2147483647L
// AVR:#define __INT32_TYPE__ long int
@@ -2017,7 +2017,7 @@
// AVR:#define __SIZE_TYPE__ unsigned int
// AVR:#define __STDC__ 1
// AVR:#define __UINT16_MAX__ 65535U
-// AVR:#define __UINT16_TYPE__ unsigned short
+// AVR:#define __UINT16_TYPE__ unsigned int
// AVR:#define __UINT32_C_SUFFIX__ UL
// AVR:#define __UINT32_MAX__ 4294967295UL
// AVR:#define __UINT32_TYPE__ long unsigned int
More information about the cfe-commits
mailing list