[PATCH] D120244: [clang][sema] Enable first-class bool support for C2x

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 12:48:05 PST 2022


aaron.ballman added a comment.

Precommit CI is failing:

Failed Tests (1):

  Clang :: Headers/stdbool.c



================
Comment at: clang/lib/Headers/stdbool.h:18
+#warning                                                                       \
+    "the <stdbool.h> header is deprecated in C2x. bool, true and false can be used without it."
+#elif !defined(__cplusplus)
----------------
I'd go with a slightly shorter form of this; the noreturn one was a bit weird because there were multiple alternatives you could use (`_Noreturn` or `[[noreturn]]`), but in this case, it's just "don't include this header and everything will be fine".


================
Comment at: clang/test/Headers/stdbool.c:2
+// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c11 -E -dM %s 2>&1 | FileCheck --check-prefix=CHECK-C11 %s
+// RUN: %clang_cc1 -fgnuc-version=4.2.1 -std=c2x -E -dM %s 2>&1 | FileCheck --check-prefix=CHECK-C2X %s
+
----------------
If you're playing along at home, `stdbool.cpp` tests the C++ behavior, so we don't need an additional RUN line here for that.

However, I'd appreciate a RUN line that defines `_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS` to demonstrate we don't emit the warning or the defines in that case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120244/new/

https://reviews.llvm.org/D120244



More information about the cfe-commits mailing list