zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Consider command line argument to disable "optional clause warnings"

Open Mi-La opened this issue 7 years ago • 2 comments

When an optional field depends on another optional field or on an optional parameter, zserio tries to check that the optional clause for both fields is the same. However we are only able to compare the two expressions as strings and when the strings are not equal, we fire the warning, even when the expressions are semantically the same. The warning is still very useful to inform a user that something could be wrong, so it's not a good idea to remove the warning. However, to be able to write a warning free zserio source, we should be able to disable this warning at least from command line.

Mi-La avatar Oct 11 '18 06:10 Mi-La

Consider to improve the evaluation of this warning as well. There are some obvious use cases where text compare is not enough but which can be solved anyway. Example:

struct OptionalValue
{
    bool    hasValue;
    uint32  value if hasValue;
};

struct Holder(OptionalValue optionalValue)
{
    ArrayHolder(optionalValue.value) arrayHolder if optionalValue.hasValue;
};

struct ArrayHolder(uint32 value)
{
    uint8   array[value];
};

Warning:

[WARNING] example.zs:9:38: Parameterized field 'arrayHolder' has different optional clause than parameters.

mikir avatar Aug 13 '19 13:08 mikir

Consider to improve the evaluation of this warning as well. There are some obvious use cases where text compare is not enough but which can be solved anyway. Example:

struct OptionalValue
{
    bool    hasValue;
    uint32  value if hasValue;
};

struct Holder(OptionalValue optionalValue)
{
    ArrayHolder(optionalValue.value) arrayHolder if optionalValue.hasValue;
};

struct ArrayHolder(uint32 value)
{
    uint8   array[value];
};

Warning:

[WARNING] example.zs:9:38: Parameterized field 'arrayHolder' has different optional clause than parameters.

This will be solved within the scope of issue #360.

mikir avatar Feb 07 '22 13:02 mikir

This will be done within scope of issue #422.

mikir avatar Oct 07 '22 11:10 mikir