[clang] [MSP430] Default to unsigned char (PR #115964)

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Alexander Richardson (arichardson)

<details>
<summary>Changes</summary>

This matches the ABI document at https://www.ti.com/lit/pdf/slaa534 as
well as the GCC implementation.

Partially fixes https://github.com/llvm/llvm-project/issues/115957.


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


2 Files Affected:

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


``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 0952262c360185..75379e0a00b981 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1341,6 +1341,7 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) {
     return false;
 
   case llvm::Triple::hexagon:
+  case llvm::Triple::msp430:
   case llvm::Triple::ppcle:
   case llvm::Triple::ppc64le:
   case llvm::Triple::riscv32:
diff --git a/clang/test/Driver/msp430-char.c b/clang/test/Driver/msp430-char.c
new file mode 100644
index 00000000000000..4f62eb167e1c84
--- /dev/null
+++ b/clang/test/Driver/msp430-char.c
@@ -0,0 +1,5 @@
+/// Check that char is unsigned by default.
+// RUN: %clang -### %s --target=msp430 -c 2>&1
+// RUN: %clang -### %s --target=msp430 -c 2>&1 | FileCheck%s
+// CHECK: "-cc1" "-triple" "msp430"
+// CHECK-SAME: "-fno-signed-char"

``````````

</details>


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


More information about the cfe-commits mailing list