[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK closed https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK edited https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s ZijunZhaoCCK wrote: I see. I already remove! https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/4] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/4] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/4] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/4] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s AaronBallman wrote: Ah! There is no c20 release. There is C89/C90, C99, C11/C1x, C17/C18/C1y, and C23/C2x https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK edited https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s ZijunZhaoCCK wrote: Nope, I just want to test c20 and c23. But yes I think I should add `std=c11/c17/...` like below https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -23,6 +23,7 @@ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L #define __STDC_VERSION_STDCKDINT_H__ 202311L +#endif AaronBallman wrote: GCC exposes this value in all C and C++ language modes, so we should go ahead and remove the `#if` entirely and just always define the macro. https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s AaronBallman wrote: This triple is the same as the one below (c2x and c23 are aliases), did you mean to use `-std=c11` or something along those lines? https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/3] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/2] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/2] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 1/2] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: >From 4e2fd920121b15e014a6146c6c6672973bae4443 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH 2/2] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst | 2 +- clang/lib/Headers/stdckdint.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d0de52a5bf122f4..1b1f25ae244ef9f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L jrtc27 wrote: This needs to stay, `__STDC_VERSION_STDCKDINT_H__` is defined by C23, not just something Clang invented https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. jrtc27 wrote: Don't start a sentence with And https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" jrtc27 wrote: And this test needs to stay https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
llvmbot wrote: @llvm/pr-subscribers-backend-x86 Author: None (ZijunZhaoCCK) Changes Update some tests and docs. --- Full diff: https://github.com/llvm/llvm-project/pull/69649.diff 6 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+1-1) - (modified) clang/lib/Headers/stdckdint.h (-4) - (modified) clang/test/C/C2x/n2359.c (-5) - (modified) clang/test/C/C2x/n2683.c (+1) - (modified) clang/test/C/C2x/n2683_2.c (+1) - (modified) clang/test/Headers/stdckdint.c (+5-2) ``diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: `` https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK ready_for_review https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/69649 >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
@@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s ZijunZhaoCCK wrote: I don't add tests in clang/test/Headers/c11.c because I think here already covers and there are some specific flags/arguments in some of commands in c11.c. https://github.com/llvm/llvm-project/pull/69649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Update stdckdint.h and make it available in pre-C23 modes. (PR #69649)
https://github.com/ZijunZhaoCCK created https://github.com/llvm/llvm-project/pull/69649 Update some tests and docs. >From 0c57e45f6ee16e43cc6388b1ca6beb88bbc7b925 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Thu, 19 Oct 2023 22:23:03 + Subject: [PATCH] Update stdckdint.h and make it available in pre-C23 modes. Update some tests and docs. --- clang/docs/ReleaseNotes.rst| 2 +- clang/lib/Headers/stdckdint.h | 4 clang/test/C/C2x/n2359.c | 5 - clang/test/C/C2x/n2683.c | 1 + clang/test/C/C2x/n2683_2.c | 1 + clang/test/Headers/stdckdint.c | 7 +-- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index fc8caf9221b9d29..d0de52a5bf122f4 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -177,7 +177,7 @@ C23 Feature Support - Clang now supports ``N3007 Type inference for object definitions``. - Clang now supports which defines several macros for performing - checked integer arithmetic. + checked integer arithmetic. And it is also exposed in pre-C23 modes. Non-comprehensive list of changes in this release - diff --git a/clang/lib/Headers/stdckdint.h b/clang/lib/Headers/stdckdint.h index 22972d78d9077a4..77290b260ff3bd4 100644 --- a/clang/lib/Headers/stdckdint.h +++ b/clang/lib/Headers/stdckdint.h @@ -21,9 +21,6 @@ /* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __STDC_VERSION_STDCKDINT_H__ 202311L - // Both A and B shall be any integer type other than "plain" char, bool, a bit- // precise integer type, or an enumerated type, and they need not be the same. @@ -38,7 +35,6 @@ #define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R)) #define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R)) #define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R)) -#endif #endif /* __STDC_HOSTED__ */ #endif /* __STDCKDINT_H */ diff --git a/clang/test/C/C2x/n2359.c b/clang/test/C/C2x/n2359.c index dc38bab43c9db8d..0a1b801e505e146 100644 --- a/clang/test/C/C2x/n2359.c +++ b/clang/test/C/C2x/n2359.c @@ -33,8 +33,3 @@ #error "__STDC_VERSION_STDINT_H__ not defined" // expected-error@-1 {{"__STDC_VERSION_STDINT_H__ not defined"}} #endif - -#include -#ifndef __STDC_VERSION_STDCKDINT_H__ -#error "__STDC_VERSION_STDCKDINT_H__ not defined" -#endif diff --git a/clang/test/C/C2x/n2683.c b/clang/test/C/C2x/n2683.c index 0c666c5fd8782ba..a785d46c063c2cc 100644 --- a/clang/test/C/C2x/n2683.c +++ b/clang/test/C/C2x/n2683.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c2x %s // RUN: %clang_cc1 -triple=x86_64 -verify -ffreestanding -std=c23 %s /* WG14 N2683: Clang 18 diff --git a/clang/test/C/C2x/n2683_2.c b/clang/test/C/C2x/n2683_2.c index 247f6de8fe4bfe1..867d6b876cf0d9d 100644 --- a/clang/test/C/C2x/n2683_2.c +++ b/clang/test/C/C2x/n2683_2.c @@ -1,4 +1,5 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c2x %s | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -o - -std=c23 %s | FileCheck %s #include diff --git a/clang/test/Headers/stdckdint.c b/clang/test/Headers/stdckdint.c index 896c740360065b6..7774cecfa7c3317 100644 --- a/clang/test/Headers/stdckdint.c +++ b/clang/test/Headers/stdckdint.c @@ -1,12 +1,15 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c99 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c17 %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c2x %s -o - | FileCheck %s // RUN: %clang_cc1 -triple=x86_64 -emit-llvm -verify -std=c23 %s -o - | FileCheck %s // expected-no-diagnostics +#include #include -_Static_assert(__STDC_VERSION_STDCKDINT_H__ == 202311L, ""); - // CHECK-LABEL: define dso_local zeroext i1 @test_ckd_add( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits