Small changes to make the codebase more Win friendly
Minor changes that came up while trying building with MSVC.
Bug: 174454879
Change-Id: Ie34f3f8bb0c8ed879672eaffba34c210809618b0
diff --git a/src/protozero/protoc_plugin/cppgen_plugin.cc b/src/protozero/protoc_plugin/cppgen_plugin.cc
index 0cdd68e..164fb63 100644
--- a/src/protozero/protoc_plugin/cppgen_plugin.cc
+++ b/src/protozero/protoc_plugin/cppgen_plugin.cc
@@ -153,8 +153,10 @@
cc_printer.Print("#include \"perfetto/protozero/proto_decoder.h\"\n");
cc_printer.Print("#include \"perfetto/protozero/scattered_heap_buffer.h\"\n");
cc_printer.Print(kHeader);
+ cc_printer.Print("#if defined(__GNUC__) || defined(__clang__)\n");
cc_printer.Print("#pragma GCC diagnostic push\n");
cc_printer.Print("#pragma GCC diagnostic ignored \"-Wfloat-equal\"\n");
+ cc_printer.Print("#endif\n");
// Generate includes for translated types of dependencies.
@@ -335,8 +337,10 @@
h_printer.Print("} // namespace $n$\n", "n", ns);
cc_printer.Print("} // namespace $n$\n", "n", ns);
}
-
+ cc_printer.Print("#if defined(__GNUC__) || defined(__clang__)\n");
cc_printer.Print("#pragma GCC diagnostic pop\n");
+ cc_printer.Print("#endif\n");
+
h_printer.Print("\n#endif // $g$\n", "g", include_guard);
return true;