[clang] [Xtensa] Default to unsigned char (PR #115967)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 16:24:52 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Alexander Richardson (arichardson)

<details>
<summary>Changes</summary>

This matches GCC.

Partially fixes https://github.com/llvm/llvm-project/pull/115964


---
Full diff: https://github.com/llvm/llvm-project/pull/115967.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+1) 
- (added) clang/test/Driver/xtensa-char.c (+4) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 0952262c360185..29954bfbc560c1 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1347,6 +1347,7 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) {
   case llvm::Triple::riscv64:
   case llvm::Triple::systemz:
   case llvm::Triple::xcore:
+  case llvm::Triple::xtensa:
     return false;
   }
 }
diff --git a/clang/test/Driver/xtensa-char.c b/clang/test/Driver/xtensa-char.c
new file mode 100644
index 00000000000000..13f8f67727e75d
--- /dev/null
+++ b/clang/test/Driver/xtensa-char.c
@@ -0,0 +1,4 @@
+/// Check that char is unsigned by default.
+// RUN: %clang -### %s --target=xtensa -c 2>&1 | FileCheck %s
+// CHECK: "-cc1" "-triple" "xtensa"
+// CHECK-SAME: "-fno-signed-char"

``````````

</details>


https://github.com/llvm/llvm-project/pull/115967


More information about the cfe-commits mailing list