Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121722

headersclean does not pass the /utf-8 compiler flag by default for MSVC

    XMLWordPrintable

Details

    • Windows
    • 63f83fb13 (dev), 0075672da (dev)

    Description

      On Windows, most of users do not use UTF-8 for system locale for legacy programs compatibility.

      And, MSVC's cl decodes source code with system locale code page, for instance, CP949 in Korean Windows.

      This behavior can be overridden with /utf-8 flag (which corresponds to set /source-charset:utf-8 /execution-charset:utf-8 simultaneously).

      Without /utf-8 flag, if there exists any non-ascii unicode character in source code, cl emits C4819 warning and, I don't know where it is set but, the warning treated as error and compilation fails.

      This corresponds to even the QtCore module because there are non-ascii characters in comment, for instance, in qproperty.h,

      ‘std::source_location::current()’
      

      where quotation marks are non-ascii.

      As a matter of fact, I guess, most of non-ascii characters appear at comment only and I think adding /utf-8 flag by default is harmless.
      Or, at least, /source-charset:utf-8 should be harmless because Qt's source codes are already encoded in UTF-8.
      I am not sure about /execution-charset:utf-8 flag but I think you know what you should use although I've never encountered issue for /utf-8 flag anyway.

      There are some build scripts which contains hardcoded compiler flags, for instance, in QtWebEngine, the build script for gn contains hardcoded compiler flags for msvc. Such list should contain /utf-8 or /source-charset:utf-8 at least too.

      To be clear, this is a bug to be fixed not a feature request nice to have because Windows/MSVC is officially supported platform and Qt should be compilable on Windows with MSVC by default.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              semlanik Alexey Edelev
              bylee Byoung-young Lee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes