aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/proto_text
diff options
context:
space:
mode:
authorGravatar Derek Murray <mrry@google.com>2018-05-17 07:10:01 -0700
committerGravatar GitHub <noreply@github.com>2018-05-17 07:10:01 -0700
commit025192b30c7abf125aba1691d5c7e9e048c644ed (patch)
treed9a836b5c5b50ada24dff156cf3d8fc191344545 /tensorflow/tools/proto_text
parent2c5e94c075454bf23bfa5a8a83e2d05011f4758e (diff)
Include <algorithm> in .pb_text.cc generated files
The generated code depends on this header for `std::stable_sort()`. Until now we've been lucky that this header is included indirectly on the platforms for which we build. Fixes #19323.
Diffstat (limited to 'tensorflow/tools/proto_text')
-rw-r--r--tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc b/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
index 62e29b5128..aa56cc676d 100644
--- a/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
+++ b/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
@@ -803,6 +803,9 @@ void Generator::Generate(const FileDescriptor& fd) {
// Add header to cc file.
SetOutput(&cc_);
Print("// GENERATED FILE - DO NOT MODIFY");
+ Print();
+ Print("#include <algorithm>"); // for `std::stable_sort()`
+ Print();
headers = {GetProtoTextHeaderName(fd, true /* impl */)};
AddHeadersToCurrentSection(headers);
Print();