zezax / one

This is the "one": Linuxy infrastructureish mostly C++ code.
MIT License
2 stars 0 forks source link

Serializer.cpp compilation failure #28

Closed sfnd closed 1 year ago

sfnd commented 1 year ago

Ubuntu 20.04.2, gcc version 10.3.0

g++ -c -MMD -MT ../_build/lib/Serializer.o -MT ../_build/lib/Serializer.d -std=c++20 -g -fsanitize=address -Wall -Wextra -Wshadow -Wpointer-arith -Wwrite-strings -Wsign-promo -Wuninitialized -Wconversion -Wfloat-equal -Wrestrict -Wdisabled-optimization -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wlogical-op -Wnull-dereference -Woverloaded-virtual -Wuseless-cast -Wimplicit-fallthrough=2 -Wmissing-include-dirs -Werror -iquote ../include Serializer.cpp -o ../_build/lib/Serializer.o In file included from Serializer.cpp:10: ../include/Proxy.h: In instantiation of ‘static zezax::red::DfaProxy::Value zezax::red::DfaProxy::resultAndDeadEnd(zezax::red::Result, bool) [with zezax::red::Format fmt = zezax::red::fmtDirect1; zezax::red::DfaProxy::Value = unsigned char; zezax::red::Result = int]’: Serializer.cpp:40:49: required from ‘void zezax::red::{anonymous}::appendStateImpl(std::string&, const zezax::red::DfaState&, zezax::red::CharIdx, const std::vector<long unsigned int, std::allocator >&) [with zezax::red::Format fmt = zezax::red::fmtDirect1; std::string = std::__cxx11::basicstring; zezax::red::CharIdx = unsigned int]’ Serializer.cpp:201:60: required from here ../include/Proxy.h:166:32: error: conversion from ‘zezax::red::Result’ {aka ‘int’} to ‘zezax::red::DfaProxy::Value’ {aka ‘unsigned char’} may change value [-Werror=conversion] 166 | return (res & resultMask) | (de << deadEndShift_); | ~~~~^~~~~~~ ../include/Proxy.h: In instantiation of ‘static zezax::red::DfaProxy::Value zezax::red::DfaProxy::resultAndDeadEnd(zezax::red::Result, bool) [with zezax::red::Format fmt = zezax::red::fmtDirect2; zezax::red::DfaProxy::Value = short unsigned int; zezax::red::Result = int]’: Serializer.cpp:40:49: required from ‘void zezax::red::{anonymous}::appendStateImpl(std::string&, const zezax::red::DfaState&, zezax::red::CharIdx, const std::vector<long unsigned int, std::allocator >&) [with zezax::red::Format fmt = zezax::red::fmtDirect2; std::string = std::__cxx11::basic_string; zezax::red::CharIdx = unsigned int]’ Serializer.cpp:204:60: required from here ../include/Proxy.h:166:32: error: conversion from ‘zezax::red::Result’ {aka ‘int’} to ‘zezax::red::DfaProxy::Value’ {aka ‘short unsigned int’} may change value [-Werror=conversion] cc1plus: all warnings being treated as errors make[1]: [../red.gmake:70: ../_build/lib/Serializer.o] Error 1 make[1]: Leaving directory '/home/john/web/zezax/quol/red/lib' make: [Makefile:26: all-lib] Error 2

zezax commented 1 year ago

I get the same error on Debian bullseye with gcc 10.2.1-6. The fix is probably just some casts.