[clang] [llvm] Enable fexec-charset option (PR #138895)

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 13:16:56 PDT 2025


================
@@ -416,8 +416,7 @@ Builtin Macros
 ``__clang_literal_encoding__``
   Defined to a narrow string literal that represents the current encoding of
   narrow string literals, e.g., ``"hello"``. This macro typically expands to
-  "UTF-8" (but may change in the future if the
-  ``-fexec-charset="Encoding-Name"`` option is implemented.)
+  the text encoding specified by -fexec-charset if specified, or the system charset.
----------------
zygoloid wrote:

The "typically" here seems wrong -- specifying `-fexec-charset` is atypical, and if it's specified then the macro *always* (not only typically) expands to that. Also referring to "the system charset" doesn't really seem right, given that for non-z/OS we use UTF-8 regardless of what the operating system would consider to be its character set. How about:

```suggestion
  Defined to a narrow string literal that represents the current encoding of
  narrow string literals, e.g., ``"hello"``. This macro expands to the text
  encoding specified by ``-fexec-charset`` if any, or a system-specific default
  otherwise: ``"IBM-1047"`` on z/OS and ``"UTF-8"`` on all other systems.
```

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


More information about the llvm-commits mailing list