Skip to content

EmbeddedProto v3.5.0 - build warnings using gcc  #77

Open
@eS-Ha-79

Description

@eS-Ha-79

Hi,

i'm using gcc (13.2.1 but shouldn't matter) with additional warnings enabled:
-Wall -Wextra -Wdouble-promotion

float fields

With messages containing float fields, the following warning(s) are produced in the serialize() function:

warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  910 |       if((0.0 != minimum_.get()) && (::EmbeddedProto::Error::NO_ERRORS == return_value))

I guess changing "0.0" to "0.0f" in Field.py -> class FieldBasic(Field) -> type_to_default_value (lines 159+) for
the dictionary entry FieldDescriptorProto.TYPE_FLOAT should be enough.

empty messages

Using empty messages (like google.protobuf.Empty) there are some unused parameter warnings (generated constructors, assignment operators and serialize() ). Personally, i added [[maybe_unused]] attributes in TypeDefMsg.h but there might be better ways, since this is CPP17+:

  • Line 38: {{ typedef.get_name() }}([[maybe_unused]] const {{typedef.get_name()}}& rhs )
  • Line 60: {{ typedef.get_name() }}([[maybe_unused]] const {{typedef.get_name()}}&& rhs ) noexcept
  • Line 100: {{ typedef.name }}& operator=([[maybe_unused]] const {{ typedef.name }}& rhs)
  • Line 123: {{ typedef.name }}& operator=([[maybe_unused]] const {{ typedef.name }}&& rhs) noexcept
  • Line 159: ::EmbeddedProto::Error serialize([[maybe_unused]] ::EmbeddedProto::WriteBufferInterface& buffer) const override

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions