From 307af628e646cd67e659f327e549542c0f5e31b7 Mon Sep 17 00:00:00 2001 From: Austin Schuh Date: Fri, 5 Jun 2015 22:46:01 -0700 Subject: Marked another compiler literal unsigned. When compiling a protobuf with gcc 4.1.2 for powerpc, I ran into another of 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 +- src/google/protobuf/compiler/plugin.pb.cc | 2 +- src/google/protobuf/descriptor.pb.cc | 34 ++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 212fe2e1..af85919a 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -3510,7 +3510,7 @@ GenerateByteSize(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), "mask", SimpleItoa(mask)); printer->Indent(); diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 344ed450..e7890fae 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -913,7 +913,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes( int CodeGeneratorResponse_File::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 7) { + if (_has_bits_[0 / 32] & 7u) { // optional string name = 1; if (has_name()) { total_size += 1 + diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 755c2617..fc13d8dc 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1648,7 +1648,7 @@ void FileDescriptorProto::SerializeWithCachedSizes( int FileDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 3) { + if (_has_bits_[0 / 32] & 3u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -1664,7 +1664,7 @@ int FileDescriptorProto::ByteSize() const { } } - if (_has_bits_[9 / 32] & 3584) { + if (_has_bits_[9 / 32] & 3584u) { // optional .google.protobuf.FileOptions options = 8; if (has_options()) { total_size += 1 + @@ -2534,7 +2534,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes( int DescriptorProto_ExtensionRange::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 3) { + if (_has_bits_[0 / 32] & 3u) { // optional int32 start = 1; if (has_start()) { total_size += 1 + @@ -2817,7 +2817,7 @@ void DescriptorProto_ReservedRange::SerializeWithCachedSizes( int DescriptorProto_ReservedRange::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 3) { + if (_has_bits_[0 / 32] & 3u) { // optional int32 start = 1; if (has_start()) { total_size += 1 + @@ -3373,7 +3373,7 @@ void DescriptorProto::SerializeWithCachedSizes( int DescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 129) { + if (_has_bits_[0 / 32] & 129u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -4558,7 +4558,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes( int FieldDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 255) { + if (_has_bits_[0 / 32] & 255u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -5633,7 +5633,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes( int EnumDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 5) { + if (_has_bits_[0 / 32] & 5u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -6102,7 +6102,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes( int EnumValueDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 7) { + if (_has_bits_[0 / 32] & 7u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -6569,7 +6569,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes( int ServiceDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 5) { + if (_has_bits_[0 / 32] & 5u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -7165,7 +7165,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes( int MethodDescriptorProto::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 63) { + if (_has_bits_[0 / 32] & 63u) { // optional string name = 1; if (has_name()) { total_size += 1 + @@ -8240,7 +8240,7 @@ void FileOptions::SerializeWithCachedSizes( int FileOptions::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 255) { + if (_has_bits_[0 / 32] & 255u) { // optional string java_package = 1; if (has_java_package()) { total_size += 1 + @@ -8289,7 +8289,7 @@ int FileOptions::ByteSize() const { } } - if (_has_bits_[8 / 32] & 16128) { + if (_has_bits_[8 / 32] & 16128u) { // optional bool java_generic_services = 17 [default = false]; if (has_java_generic_services()) { total_size += 2 + 1; @@ -9279,7 +9279,7 @@ void MessageOptions::SerializeWithCachedSizes( int MessageOptions::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 15) { + if (_has_bits_[0 / 32] & 15u) { // optional bool message_set_wire_format = 1 [default = false]; if (has_message_set_wire_format()) { total_size += 1 + 1; @@ -9939,7 +9939,7 @@ void FieldOptions::SerializeWithCachedSizes( int FieldOptions::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 63) { + if (_has_bits_[0 / 32] & 63u) { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; if (has_ctype()) { total_size += 1 + @@ -10498,7 +10498,7 @@ void EnumOptions::SerializeWithCachedSizes( int EnumOptions::ByteSize() const { int total_size = 0; - if (_has_bits_[0 / 32] & 3) { + if (_has_bits_[0 / 32] & 3u) { // optional bool allow_alias = 2; if (has_allow_alias()) { total_size += 1 + 1; @@ -12410,7 +12410,7 @@ void UninterpretedOption::SerializeWithCachedSizes( int UninterpretedOption::ByteSize() const { int total_size = 0; - if (_has_bits_[1 / 32] & 126) { + if (_has_bits_[1 / 32] & 126u) { // optional string identifier_value = 3; if (has_identifier_value()) { total_size += 1 + @@ -13248,7 +13248,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( int SourceCodeInfo_Location::ByteSize() const { int total_size = 0; - if (_has_bits_[2 / 32] & 12) { + if (_has_bits_[2 / 32] & 12u) { // optional string leading_comments = 3; if (has_leading_comments()) { total_size += 1 + -- cgit v1.2.3