MengRao / fmtlog

fmtlog is a performant fmtlib-style logging library with latency in nanoseconds.
MIT License
807 stars 124 forks source link

warning generated by clang (12): -Wstring-plus-int #18

Closed matthijs closed 2 years ago

matthijs commented 2 years ago

When compiling with clang I get this warning, seems harmless to me, but I'd like a clean compile. Is there a way to fix this?

In file included from /home/matthijs/Projects/moneymaker/moneymaker/fmtlog/fmtlog.h:782:
/home/matthijs/Projects/moneymaker/moneymaker/fmtlog/fmtlog-inl.h:375:38: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
    logLevel = "DBG INF WRN ERR OFF" + (info.logLevel << 2);
               ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/matthijs/Projects/moneymaker/moneymaker/fmtlog/fmtlog-inl.h:454:7: note: in instantiation of member function 'fmtlogDetailT<0>::handleLog' requested here
      handleLog(fmt::string_view(tb->name, tb->nameSize), h);
      ^
/home/matthijs/Projects/moneymaker/moneymaker/fmtlog/fmtlog-inl.h:552:31: note: in instantiation of member function 'fmtlogDetailT<0>::poll' requested here
  fmtlogDetailWrapper<>::impl.poll(forceFlush);
                              ^
/home/matthijs/Projects/moneymaker/moneymaker/fmtlog/fmtlog-inl.h:375:38: note: use array indexing to silence this warning
    logLevel = "DBG INF WRN ERR OFF" + (info.logLevel << 2);
                                     ^
               &                     [                     ]
1 warning generated.

Thanks

MengRao commented 2 years ago

Fixed.

matthijs commented 2 years ago

Thanks, warning disappeared!