[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Updates: Status: WontFix Comment #24 on issue 83 by xiaof...@google.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 https://code.google.com/p/protobuf/issues/detail?id=83 Please submit patches to our new github site: https://github.com/google/protobuf/pulls -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #23 on issue 83 by kevin.ar...@gmail.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 This patch addresses more of the warnings by making casts that implicitly narrow from unsigned to int or size_t to unsigned or int explicit. It would be better to fix the code by using the correct type (size_t) to represent sizes of collections and strings, but that would be a far more intrusive change set. Attachments: make_narrowing_casts_explicit.patch 7.4 KB -- You received this message because this project is configured to send all issue notifications to this address. You may adjust your notification preferences at: https://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #22 on issue 83 by heydu...@gmail.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 We applied some more patches to our copy of protobuf; Doesn't address all of the problems listed, obviously, but it might be useful to some readers. It gave us a clean build, at least. thanks. ad Attachments: patch.diff 1.5 KB -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #21 on issue 83 by steve_ch...@hotmail.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 For compatibility with existing code the size of size_t and long int are not the same when Visual C++ targets the X64 machine type and raises compilation warnings. For my project (adding protobuf support to a large very-large existing system) it was not safe to globally ignore 64-bit portability warnings. I致e added #pragma warning conditional code to protoc to suppress 64-bit portability warnings for the scope of the generated files, and solve the problem without explicit support for MSVC being built into the core of protobuf. Our user-patch has been submitted to liuj...@google.com -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #20 on issue 83 by jacobgla...@yahoo.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 This is getting really annoying for me. I'm willing to start providing patches, but I'd like to discuss before I spend a lot of time. The first thing I noticed is that WireFormat::VerifyUTF8String(const char* data, int size, WireFormat::Operation op) is always used on std::string. I get tons of warnings in the pb.cc files about the std::string::size_type and that second argument not matching in size. I'd suggest changing that to WireFormat::VerifyUTF8String(const std::string& data, WireFormat::Operation op) This requires a change to the built-in pb.cc files and cpp generator. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #18 on issue 83 by ken...@google.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Well that's easy enough. Revision 351. Leaving the bug open because I don't think this is the only thing people cared about. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #17 on issue 83 by heydunne: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 My apologies; the functions did not change; I was reading an *internally* patched version of 2.2.0. FWIW, we modified src/google/protobuf/io/coded_stream.h with the attached patch ( it does not resolve all the issues described in this bug report, but it resolved our compilation problems with WriteString and WriteStringToArray without runtime issues, and without having to suppress compilation warnings; perhaps it might help others here ) As an aside, thanks for making protobuf open-source, it's had a profound positive effect on some of our ipc work. thanks Attachments: difference.txt 266 bytes -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #16 on issue 83 by ken...@google.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 The code of those two functions did not change between 2.2.0 and 2.3.0, so I'm not sure what you mean when you say 2.2.0 used static_casts there. Anyway, this bug is marked NeedPatchFromUser. You can see above that halostatue proposed a patch but I felt that it was too invasive. If you can produce a patch that is better then we can consider submitting it. However, we simply cannot satisfy every possible compiler warning configuration used by every user. I'll accept patches that are simple and clean, but a better solution would be for you to tell your compiler to ignore warnings in the protobuf headers. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #15 on issue 83 by heydunne: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Hi. I wonder if there has been any development in this since the last post. We upgraded to 2.3.0 to support vc10 compilation, and these warnings are bothering the build gatekeepers in our team. I notice that v2.2.0 uses static_cast in both CodedOutputStream::WriteString and CodedOutputStream::WriteStringToArray whereas 2.3.0 does not. Since the target functions (WriteRaw,WriteRawToArray) will implicitly convert the size_t parameter to int anyways, the solution that seems the easiest to us is to revert to casting those arguments to using static_cast in the calling functions ( as was done in 2.2.0 ) Is there any reason not to do this? thanks Aidan Dunne. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #14 on issue 83 by temporal: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 The problem with the truncating_cast as you've specified is that both warning 4244 and 4267 are reported; So disable both, then. Still better than adding pragmas everywhere where this happens. A possible different alternative is to change the code generator so that the generated .cc files include these headers with the appropriate pragma I don't think that helps because it's not just the .pb.cc files that must include these. Your own code may need to use them directly as well. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #13 on issue 83 by halostatue: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Yeah, it's a little ugly, but it's consistent with what I've seen in gtest. The problem with the truncating_cast as you've specified is that both warning 4244 and 4267 are reported; there are probably others you'd have to worry about. I think that explicit casts may be the way to fix this, but I'm not sure offhand (we'd have to test it in our build, which I don't see happening for a few days). This matters very much to us because we have "treat warnings as errors" and these are in headers that, if I recall correctly, we can't avoid using in our code. A possible different alternative is to change the code generator so that the generated .cc files include these headers with the appropriate pragma warning(disable: 4244 4267) guard (again; I don't recall if it's "warning(disable: 4244 4267)" or "warning(disable: 4244, 4267)"). -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #12 on issue 83 by ken...@google.com: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Yikes, adding #pragmas all over like that is pretty ugly. What is the proper way to prevent these warnings in MSVC, without disabling them? Explicit casts? I'd much rather do that than add pragmas everywhere. Better yet, maybe we could define a new cast: template To truncating_cast(From value) { #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4244) #endif return value; #ifdef _MSC_VER #pragma warning(pop) #endif } Then use that everywhere... -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #11 on issue 83 by halostatue: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 I apparently fat-fingered the warning in the previous upload, suppressing 4224 instead of 4244. This diff corrects that (and incorporates the previous diff, too). Attachments: fix-vs-warnings.diff 3.2 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #10 on issue 83 by halostatue: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Visual Studio cannot disable warnings for third-party headers. I'm not sure that disabling these warnings in stubs/common.h is the right place for this; looking through the externed gtest code (where a number of #pragma warning options are used), these are tightly constrained to the code where the warning is generated. As such, the attached patch does the same. [This patch suppresses both the 32-bit and the 64-bit warnings.] Sorry for the multiple comments; this is the final correct version. Attachments: fix-vs-warnings.diff 3.2 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #9 on issue 83 by halostatue: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Visual Studio cannot disable warnings for third-party headers. I'm not sure that disabling these warnings in stubs/common.h is the right place for this; looking through the externed gtest code (where a number of #pragma warning options are used), these are tightly constrained to the code where the warning is generated. As such, the attached patch does the same. [This patch suppresses both the 32-bit and the 64-bit warnings.] Attachments: fix-vs-warnings.h 3.2 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 83 in protobuf: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008
Comment #8 on issue 83 by halostatue: protobuf does not compile cleanly in 64-bit mode in Visual Studio 2008 http://code.google.com/p/protobuf/issues/detail?id=83 Visual Studio cannot disable warnings for third-party headers. I'm not sure that disabling these warnings in stubs/common.h is the right place for this; looking through the externed gtest code (where a number of #pragma warning options are used), these are tightly constrained to the code where the warning is generated. As such, the attached patch does the same. Attachments: fix-vs-warnings.h 1.0 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.