Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42744 lupdate needs C++11 support
  3. QTBUG-42736

lupdate confused by raw string literals (C++11)

    XMLWordPrintable

Details

    • ee9f6ec9b9e8f0d18ad7e8fededb5292abb91912

    Description

      Using the new raw string literal syntax in C++11 leads to multiple warnings. The warnings were in the format:

      ..file.cpp:564: Unterminated C++ string
      ..file.cpp:566: Unterminated C++ string
      ..file.cpp:600: Unterminated C++ string
      ..file.cpp:606: Unterminated C++ string
      ..file.cpp:607: Excess closing parenthesis in C++ code (or abuse of the C++ preprocessor)

      The beginning line was:

      widget1->setStyleSheet( R"qss(
          #chkLighting { padding: 5px; }
      )qss" );

      The syntax used in this case is R"delimiter()delimiter" and lines do not need to be escaped.

      The warning seems to span multiple raw string literals because the end line, 607, is the closing semicolon in this later block:

      widget2->setStyleSheet( "background: transparent url(" + img + ");" + R"qss(
              background-repeat: no-repeat;
              background-position: left;
              background-origin: margin;
              background-clip: margin;
              margin-left: 20px;
          )qss"
      );

      If I were to guess, I would say it's possible any tr() calls between the two raw string literals (lines 566 through 600) may not be picked up by lupdate, but I haven't tried testing this.

      I have only used the syntax in the format R"delimiter()delimiter" but there are several other new string literals which can be seen:
      http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals
      http://en.cppreference.com/w/cpp/language/string_literal
      http://msdn.microsoft.com/en-us/library/69ze775t.aspx

      ...though I believe R"delimiter()delimiter" is the only one to span multiple lines, so any issues with the other string literals may not be related and may need their own ticket.

      Attachments

        Issue Links

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

          Activity

            People

              andysh Andy Shaw
              jonwd7 Jonathan
              Votes:
              36 Vote for this issue
              Watchers:
              33 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes