zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Enable conversion warnings for gcc compiler

Open mikir opened this issue 11 months ago • 1 comments

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);

mikir avatar Mar 19 '24 07:03 mikir