[clang] [clang-tools-extra] [Clang] Add support for the C `defer` TS (PR #162848)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 10 06:42:56 PST 2025
================
@@ -0,0 +1,22 @@
+/*===---- stddefer.h - Standard header for 'defer' -------------------------===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __CLANG_STDDEFER_H
+#define __CLANG_STDDEFER_H
+
+/* Provide 'defer' if '_Defer' is supported and update the predefined
+ macro accordingly. */
+#if defined __STDC_DEFER_TS25755__ && __STDC_DEFER_TS25755__ == 1
+#undef __STDC_DEFER_TS25755__
----------------
Sirraide wrote:
I suppose it should be enough to just check if it’s defined yes.
> We don't want to redefine `__STDC_DEFER_TS25755__` to 2 because we're not providing `defer` as a keyword,
Ah, I thought it should be defined to `2` if `defer` has the same meaning as `_Defer`, irrespective of whether it’s a proper keyword or a macro, but I think you’re right, it should just be `1` in our case.
https://github.com/llvm/llvm-project/pull/162848
More information about the cfe-commits
mailing list