[llvm-branch-commits] [clang] release/22.x: [clang-repl] Fix C89 incompatible keywords (#189432) (PR #189538)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 30 22:52:55 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: llvmbot

<details>
<summary>Changes</summary>

Backport 8bd83048084c27615e9536227fbb2545472915e7

Requested by: @<!-- -->vgvassilev

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


2 Files Affected:

- (modified) clang/lib/Interpreter/Interpreter.cpp (+9-2) 
- (modified) clang/test/Interpreter/pretty-print.c (+1) 


``````````diff
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 9c94cfa5ee381..2684a00ce5f07 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -337,9 +337,16 @@ const char *const Runtimes = R"(
       __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
     }
 #else
+    #if __STDC_VERSION__ < 199901L
+      #define CI_RESTRICT
+      #define CI_INLINE
+    #else
+      #define CI_RESTRICT restrict
+      #define CI_INLINE inline
+    #endif
     #define EXTERN_C extern
-    EXTERN_C void *memcpy(void *restrict dst, const void *restrict src, __SIZE_TYPE__ n);
-    EXTERN_C inline void __clang_Interpreter_SetValueCopyArr(const void* Src, void* Placement, unsigned long Size) {
+    EXTERN_C void *memcpy(void *CI_RESTRICT dst, const void *CI_RESTRICT src, __SIZE_TYPE__ n);
+    EXTERN_C CI_INLINE void __clang_Interpreter_SetValueCopyArr(const void* Src, void* Placement, unsigned long Size) {
       memcpy(Placement, Src, Size);
     }
 #endif // __cplusplus
diff --git a/clang/test/Interpreter/pretty-print.c b/clang/test/Interpreter/pretty-print.c
index b8058a762897e..9be13855eafe8 100644
--- a/clang/test/Interpreter/pretty-print.c
+++ b/clang/test/Interpreter/pretty-print.c
@@ -1,6 +1,7 @@
 // REQUIRES: host-supports-jit
 // RUN: cat %s | clang-repl -Xcc -xc  | FileCheck %s
 // RUN: cat %s | clang-repl -Xcc -std=c++11 | FileCheck %s
+// RUN: cat %s | clang-repl -Xcc -xc -Xcc -std=c89 | FileCheck %s
 
 // UNSUPPORTED: hwasan, msan
 

``````````

</details>


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


More information about the llvm-branch-commits mailing list