zserio
zserio copied to clipboard
Enable conversion warnings for gcc compiler
Enable conversion warnings (-Wconversion
) for gcc compiler and solve all findings everywhere. Example from C++ runtime library:
compiler/extensions/cpp/runtime/src/zserio/BitStreamWriter.cpp: In member function ‘void zserio::BitStreamWriter::writeUnsignedBits(uint32_t, uint8_t)’:
compiler/extensions/cpp/runtime/src/zserio/BitStreamWriter.cpp:558:56: error: conversion from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Werror=conversion]
558 | const uint8_t maskedByte = m_buffer[byteIndex] & ~(0xFFU >> bitsUsed);