[PATCH] D124996: [clang][preprocessor] Fix unsigned-ness of utf8 char literals

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 10 09:04:37 PDT 2022


tahonermann added inline comments.


================
Comment at: clang/test/Lexer/utf8-char-literal.cpp:3-4
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c2x -x c -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++1z -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c2x -x c -fsyntax-only -fchar8_t -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c2x -x c -fsyntax-only -fno-char8_t -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -fsyntax-only -verify %s
----------------
aaron.ballman wrote:
> tahonermann wrote:
> > Does the `-fchar8_t` option have any effect in C at present?
> > 
> > Gcc maintainers are currently not planning to acknowledge that option in C modes since WG14 did not want to add language dialect concerns for C. This is why [[https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm|N2653]] doesn't have wording that includes a feature test macro. The gcc maintainers pushed back on the `_CHAR8_T_SOURCE` macro mentioned in the "Implementation Experience" section.
> > 
> > I think Clang should follow suit; attempts to use `-fchar8_t` or `-fno-char8_t` in C modes should be diagnosed; which means that we don't have to exercise these options with C2x.
> > Does the -fchar8_t option have any effect in C at present?
> 
> Yes, it does: https://godbolt.org/z/1co3YYYf8  (it sets `LangOpts.Char8`)
Oh, that is very wrong. `char8_t` should be neither a keyword nor a type specifier in C modes; `char8_t` will be a typedef in C23.

@tbaeder, if you are willing to take on fixing this as well, that would be most appreciated! This doesn't need to be fixed as part of this review though. I filed https://github.com/llvm/llvm-project/issues/55373 to track this issue.


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

https://reviews.llvm.org/D124996



More information about the cfe-commits mailing list