Skip to content

Warnings in clang in generated code #616

@ksergey

Description

@ksergey

clang prints warnings during compilation:

/home/ksergey/dev/zerofw/debug1/include/orp/MappingListResponse.h:307:23: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]           
            if (count < 0 || count > 4294967294)

Related code:

       inline void wrapForEncode(char *buffer, const std::uint32_t count, std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength)          
        {                                                                                                                                                                    
    #if defined(__GNUG__) && !defined(__clang__)                                                                                                                             
    #pragma GCC diagnostic push                                                                                                                                              
    #pragma GCC diagnostic ignored "-Wtype-limits"                                                                                                                           
    #endif                                                                                                                                                                   
            if (count < 0 || count > 4294967294)                                                                                                                             
            {                                                                                                                                                                
                throw std::runtime_error("count outside of allowed range [E110]");                                                                                           
            }                                                                                                                                                                
    #if defined(__GNUG__) && !defined(__clang__)                                                                                                                             
    #pragma GCC diagnostic pop                                                                                                                                               
    #endif                                                                                                                                                                   
            m_buffer = buffer;                                                                                                                                               

SBE:

        <composite name="groupSizeEncoding" blockLength="8">                                                                                                                 
            <type name="blockLength" primitiveType="uint32"/>                                                                                                                
            <type name="numInGroup" primitiveType="uint32"/>                                                                                                                 
        </composite>  
...
    <message name="MappingListResponse" id="49" blockLength="8">                                                                                                             
        <field name="InstanceId" id="30017" type="InstanceIdNULL"/>                                                                                                          
        <group name="Mapping" id="30028" blockLength="104" dimensionType="groupSizeEncoding">                                                                                
            <field name="SecurityId" id="30002" type="SecurityId"/>                                                                                                          
            <field name="SecurityName" id="30011" type="String32"/>                                                                                                          
            <field name="ExchangeName" id="30012" type="String32"/>                                                                                                          
            <field name="Account" id="30013" type="String32"/>                                                                                                               
        </group>                                                                                                                                                             
    </message>                                                                                                                                                               

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