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


##########
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:
   Will this work instead:
   
   ```cpp
      return std::string{"\"} + path.string() + "\"";
   ```
   
   If so, I'd use that and just ommit the preceding comment.



##########
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:
   Nit: I think explicitly saying std::stable_sort instead of "its" will be 
clearer to people reading this comment without the context of this PR:
   
   "Its" -> "The std::stable_sort ..."



-- 
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