From e826837f7ebc8cb4a4a7aea520551b5b9a0121b1 Mon Sep 17 00:00:00 2001 From: Austin Schuh Date: Tue, 19 May 2015 23:22:20 -0700 Subject: Marked compiler literal unsigned. When compiling a protobuf with gcc 3.3.2 for powerpc, I ran into the following warning message: INFO: From Compiling my_proto.pb.cc powerpc-603e-linux-gcc: bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc: In member function `virtual void MyProto::Clear()': bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc:223: warning: this decimal constant is unsigned only in ISO C90 The line in the proto file that was triggering it was: if (_has_bits_[24 / 32] & 4278190080) { ZR_(field1_, field2_); } _has_bits_ is a uint32. The constant mask should therefore be unsigned. This change updates the constant to be generated as unsigned. --- src/google/protobuf/compiler/cpp/cpp_message.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/google/protobuf/compiler/cpp/cpp_message.cc') diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index bafa36f5..98929b1e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -2096,7 +2096,7 @@ GenerateClear(io::Printer* printer) { } else { if (HasFieldPresence(descriptor_->file())) { printer->Print( - "if (_has_bits_[$index$ / 32] & $mask$) {\n", + "if (_has_bits_[$index$ / 32] & $mask$u) {\n", "index", SimpleItoa(i / 8 * 8), "mask", SimpleItoa(mask)); printer->Indent(); -- cgit v1.2.3