bryancall commented on code in PR #13770:
URL: https://github.com/apache/trafficserver/pull/13770#discussion_r4162365005


##########
src/proxy/Plugin.cc:
##########
@@ -503,14 +503,19 @@ parse_plugin_yaml(const char *yaml_path)
     indexed.push_back({seq_idx++, std::move(entry)});
   }
 
-  std::stable_sort(indexed.begin(), indexed.end(), [](const IndexedEntry &a, 
const IndexedEntry &b) {
+  // seq_idx breaks ties, which keeps file order without std::stable_sort. Its 
temporary buffer
+  // trips a GCC 14 -Wfree-nonheap-object false positive in optimized builds.

Review Comment:
   Done in 966af0812753, it now says "The std::stable_sort temporary buffer".
   



##########
plugins/experimental/abuse_shield/unit_tests/test_config.cc:
##########
@@ -78,7 +78,13 @@ class TempConfig
 std::string
 yaml_path(const std::filesystem::path &path)
 {
-  return "\"" + path.string() + "\"";
+  // Appending, rather than "\"" + path.string(), avoids a GCC 12 -Wrestrict 
false positive in
+  // optimized builds.
+  std::string quoted{"\""};
+
+  quoted += path.string();
+  quoted += '"';
+  return quoted;

Review Comment:
   I tried it, and unfortunately it trips the same warning. Under GCC 12.2 at 
-O3 (the `ats/debian:12` CI image), both `"\"" + path.string() + "\""` and 
`std::string{"\""} + path.string() + "\""` fail with `-Werror=restrict`, and 
only the append form compiles. I kept the append and changed the comment in 
966af0812753 to say the std::string form fails too, so nobody tries it again.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to