[Bf-blender-cvs] [b9cd2f4531c] master: Revert "Fix modernize-raw-string-literal complaints from clang-tidy."

Howard Trickey noreply at git.blender.org
Mon Mar 8 12:50:59 CET 2021


Commit: b9cd2f4531ca670c196b0b14b1359d0f375103c2
Author: Howard Trickey
Date:   Mon Mar 8 06:45:45 2021 -0500
Branches: master
https://developer.blender.org/rBb9cd2f4531ca670c196b0b14b1359d0f375103c2

Revert "Fix modernize-raw-string-literal complaints from clang-tidy."

This reverts commit 7a34bd7c2886dfc812345c0b1649d63a9ee4666f.

Broke windows build. Can apparently fix with /Zc:preprocessor flag
for windows but need a Windows dev to make that fix.

===================================================================

M	source/blender/blenkernel/intern/cryptomatte_test.cc
M	source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
M	source/blender/blenlib/tests/BLI_string_test.cc
M	source/blender/blenlib/tests/BLI_string_utf8_test.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/cryptomatte_test.cc b/source/blender/blenkernel/intern/cryptomatte_test.cc
index 13e29cecf0a..d9be252d654 100644
--- a/source/blender/blenkernel/intern/cryptomatte_test.cc
+++ b/source/blender/blenkernel/intern/cryptomatte_test.cc
@@ -53,17 +53,17 @@ TEST(cryptomatte, layer)
   ASSERT_EQ("{}", layer.manifest());
 
   layer.add_hash("Object", 123);
-  ASSERT_EQ(R"({"Object":"0000007b"})", layer.manifest());
+  ASSERT_EQ("{\"Object\":\"0000007b\"}", layer.manifest());
 
   layer.add_hash("Object2", 123245678);
-  ASSERT_EQ(R"({"Object":"0000007b","Object2":"0758946e"})", layer.manifest());
+  ASSERT_EQ("{\"Object\":\"0000007b\",\"Object2\":\"0758946e\"}", layer.manifest());
 }
 
 TEST(cryptomatte, layer_quoted)
 {
   blender::bke::cryptomatte::CryptomatteLayer layer;
-  layer.add_hash(R"("Object")", 123);
-  ASSERT_EQ(R"({"\"Object\"":"0000007b"})", layer.manifest());
+  layer.add_hash("\"Object\"", 123);
+  ASSERT_EQ("{\"\\\"Object\\\"\":\"0000007b\"}", layer.manifest());
 }
 
 static void test_cryptomatte_manifest(std::string expected, std::string manifest)
@@ -75,15 +75,17 @@ static void test_cryptomatte_manifest(std::string expected, std::string manifest
 TEST(cryptomatte, layer_from_manifest)
 {
   test_cryptomatte_manifest("{}", "{}");
-  test_cryptomatte_manifest(R"({"Object":"12345678"})", R"({"Object": "12345678"})");
-  test_cryptomatte_manifest(R"({"Object":"12345678","Object2":"87654321"})",
-                            R"({"Object":"12345678","Object2":"87654321"})");
-  test_cryptomatte_manifest(R"({"Object":"12345678","Object2":"87654321"})",
-                            R"(  {  "Object"  :  "12345678"  ,  "Object2"  :  "87654321"  }  )");
-  test_cryptomatte_manifest(R"({"Object\"01\"":"12345678"})", R"({"Object\"01\"": "12345678"})");
+  test_cryptomatte_manifest("{\"Object\":\"12345678\"}", "{\"Object\": \"12345678\"}");
+  test_cryptomatte_manifest("{\"Object\":\"12345678\",\"Object2\":\"87654321\"}",
+                            "{\"Object\":\"12345678\",\"Object2\":\"87654321\"}");
   test_cryptomatte_manifest(
-      R"({"Object\"01\"":"12345678","Object":"12345678","Object2":"87654321"})",
-      R"({"Object\"01\"":"12345678","Object":"12345678", "Object2":"87654321"})");
+      "{\"Object\":\"12345678\",\"Object2\":\"87654321\"}",
+      "  {  \"Object\"  :  \"12345678\"  ,  \"Object2\"  :  \"87654321\"  }  ");
+  test_cryptomatte_manifest("{\"Object\\\"01\\\"\":\"12345678\"}",
+                            "{\"Object\\\"01\\\"\": \"12345678\"}");
+  test_cryptomatte_manifest(
+      "{\"Object\\\"01\\\"\":\"12345678\",\"Object\":\"12345678\",\"Object2\":\"87654321\"}",
+      "{\"Object\\\"01\\\"\":\"12345678\",\"Object\":\"12345678\", \"Object2\":\"87654321\"}");
 }
 
 TEST(cryptomatte, extract_layer_hash_from_metadata_key)
@@ -151,10 +153,10 @@ TEST(cryptomatte, session_from_stamp_data)
       MEM_callocN(sizeof(RenderResult), __func__));
   BKE_render_result_stamp_data(render_result, "cryptomatte/qwerty/name", "layer1");
   BKE_render_result_stamp_data(
-      render_result, "cryptomatte/qwerty/manifest", R"({"Object":"12345678"})");
+      render_result, "cryptomatte/qwerty/manifest", "{\"Object\":\"12345678\"}");
   BKE_render_result_stamp_data(render_result, "cryptomatte/uiop/name", "layer2");
   BKE_render_result_stamp_data(
-      render_result, "cryptomatte/uiop/manifest", R"({"Object2":"87654321"})");
+      render_result, "cryptomatte/uiop/manifest", "{\"Object2\":\"87654321\"}");
   CryptomatteSession *session = BKE_cryptomatte_init_from_render_result(render_result);
   EXPECT_NE(session, nullptr);
   RE_FreeRenderResult(render_result);
diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
index aa3e183a382..d00e8bf55fd 100644
--- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
+++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc
@@ -333,37 +333,37 @@ void graph_draw(const std::string &label,
   }
 
   f << "<div>" << label << "</div>\n<div>\n"
-    << R"(<svg version="1.1" )"
-       R"(xmlns="http://www.w3.org/2000/svg" )"
-       R"(xmlns:xlink="http://www.w3.org/1999/xlink" )"
-       R"(xml:space="preserve"\n)"
-    << R"(width=")" << view_width << R"(" height=")" << view_height << R"(">n)";
+    << "<svg version=\"1.1\" "
+       "xmlns=\"http://www.w3.org/2000/svg\" "
+       "xmlns:xlink=\"http://www.w3.org/1999/xlink\" "
+       "xml:space=\"preserve\"\n"
+    << "width=\"" << view_width << "\" height=\"" << view_height << "\">n";
 
   for (const std::pair<int, int> &e : edges) {
     const vec2<T> &uco = verts[e.first];
     const vec2<T> &vco = verts[e.second];
     int strokew = thin_line;
-    f << R"(<line fill="none" stroke="black" stroke-width=")" << strokew << R"(" x1=")"
-      << SX(uco[0]) << R"(" y1=")" << SY(uco[1]) << R"(" x2=")" << SX(vco[0]) << R"(" y2=")"
-      << SY(vco[1]) << R"(">\n)";
+    f << "<line fill=\"none\" stroke=\"black\" stroke-width=\"" << strokew << "\" x1=\""
+      << SX(uco[0]) << "\" y1=\"" << SY(uco[1]) << "\" x2=\"" << SX(vco[0]) << "\" y2=\""
+      << SY(vco[1]) << "\">\n";
     f << "  <title>[" << e.first << "][" << e.second << "]</title>\n";
     f << "</line>\n";
     if (draw_edge_labels) {
-      f << R"(<text x=")" << SX(0.5 * (uco[0] + vco[0])) << R"(" y=")"
-        << SY(0.5 * (uco[1] + vco[1])) << R"(" font-size="small">)";
+      f << "<text x=\"" << SX(0.5 * (uco[0] + vco[0])) << "\" y=\"" << SY(0.5 * (uco[1] + vco[1]))
+        << "\" font-size=\"small\">";
       f << "[" << e.first << "][" << e.second << "]</text>\n";
     }
   }
 
   int i = 0;
   for (const vec2<T> &vco : verts) {
-    f << R"(<circle fill="black" cx=")" << SX(vco[0]) << R"(" cy=")" << SY(vco[1]) << R"(" r=")"
-      << vert_radius << R"(">\n)";
+    f << "<circle fill=\"black\" cx=\"" << SX(vco[0]) << "\" cy=\"" << SY(vco[1]) << "\" r=\""
+      << vert_radius << "\">\n";
     f << "  <title>[" << i << "]" << vco << "</title>\n";
     f << "</circle>\n";
     if (draw_vert_labels) {
-      f << R"(<text x=")" << SX(vco[0]) + vert_radius << R"(" y=")" << SY(vco[1]) - vert_radius
-        << R"(" font-size="small">[)" << i << "]</text>\n";
+      f << "<text x=\"" << SX(vco[0]) + vert_radius << "\" y=\"" << SY(vco[1]) - vert_radius
+        << "\" font-size=\"small\">[" << i << "]</text>\n";
     }
     ++i;
   }
diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc
index 3f7db261ac0..88cecaa5fee 100644
--- a/source/blender/blenlib/tests/BLI_string_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_test.cc
@@ -845,12 +845,12 @@ TEST_F(StringEscape, Simple)
       {"\\A", "\\\\A"},
       {"A\\B", "A\\\\B"},
       {"?", "?"},
-      {R"("\)", R"(\"\\)"},
-      {R"(\")", R"(\\\")"},
-      {R"("\")", R"(\"\\\")"},
+      {"\"\\", "\\\"\\\\"},
+      {"\\\"", "\\\\\\\""},
+      {"\"\\\"", "\\\"\\\\\\\""},
 
-      {R"(""")", R"(\"\"\")"},
-      {R"(\\\)", R"(\\\\\\)"},
+      {"\"\"\"", "\\\"\\\"\\\""},
+      {"\\\\\\", "\\\\\\\\\\\\"},
   };
 
   testEscapeWords(equal);
@@ -868,9 +868,9 @@ TEST_F(StringEscape, Control)
       {"\f", "\\f"},
       {"A\n", "A\\n"},
       {"\nA", "\\nA"},
-      {"\n\r\t\a\b\f", R"(\n\r\t\a\b\f)"},
-      {"\n_\r_\t_\a_\b_\f", R"(\n_\r_\t_\a_\b_\f)"},
-      {"\n\\\r\\\t\\\a\\\b\\\f", R"(\n\\\r\\\t\\\a\\\b\\\f)"},
+      {"\n\r\t\a\b\f", "\\n\\r\\t\\a\\b\\f"},
+      {"\n_\r_\t_\a_\b_\f", "\\n_\\r_\\t_\\a_\\b_\\f"},
+      {"\n\\\r\\\t\\\a\\\b\\\f", "\\n\\\\\\r\\\\\\t\\\\\\a\\\\\\b\\\\\\f"},
   };
 
   testEscapeWords(escaped);
diff --git a/source/blender/blenlib/tests/BLI_string_utf8_test.cc b/source/blender/blenlib/tests/BLI_string_utf8_test.cc
index e93835ba1b6..1833945b3fd 100644
--- a/source/blender/blenlib/tests/BLI_string_utf8_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_utf8_test.cc
@@ -92,12 +92,12 @@ const char *utf8_invalid_tests[][3] = {
                   "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
                   "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
                   "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\" |",
-     "3.1.9      \"\" |", R"(@)"},
+     "3.1.9      \"\" |", "\x40"},
 /*    3.2  Lonely start characters
  *    3.2.1  All 32 first bytes of 2-byte sequences (0xc0-0xdf), each followed by a space character: */
     {"3.2.1      \"\xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf "
                   "\xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \" |",
-     "3.2.1      \"                                \" |", R"( )"},
+     "3.2.1      \"                                \" |", "\x20"},
 /*    3.2.2  All 16 first bytes of 3-byte sequences (0xe0-0xef), each followed by a space character: */
     {"3.2.2      \"\xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef \"                                 |",
      "3.2.2      \"                \"                                 |", "\x10"},



More information about the Bf-blender-cvs mailing list