halfgaar / FlashMQ

FlashMQ is a fast light-weight MQTT broker/server, designed to take good advantage of multi-CPU environments
https://www.flashmq.org/
Open Software License 3.0
185 stars 24 forks source link

CI is love, CI is life #1

Closed quinox closed 3 years ago

quinox commented 3 years ago

The CI tests 4 combinations: Clang+GCC on 20.04+18.04. The project doesn't compile on 16.04 so I left it out.

Two tweaks to the code were needed to get the compilation working on my dev server.

Don't forget to update the badge URL in the README.md to point to your own repo (Gitlab can't do this for you yet, see this issue).

Depending on your own Travis settings you might also have to enable CI for this repo, this can be done at https://travis-ci.com/account/repositories

halfgaar commented 3 years ago

Hey cool, clang building too. I should compare the results. I never worked with Clang yet.

Do I need to wait for an OK until the force pushes stop?

quinox commented 3 years ago

I polishing my work this morning with some force pushes, yes. I'm done, it's ready to be merged.

I was experimenting with OSX as well, after solving CMake problems with OpenSSL I ran into issues with epoll: this appears to require far more changes than I'm willing to do so I abandoned that idea.

quinox commented 3 years ago

I have a fix for the Clang warnings visible in both builds in d120d36. You can cherrypick it, I am not making it part of this (or another) PR since I don't really know what I'm doing at this point.

As an experiment I also used Clang 12, during compilation it throws warnings about what Clang finds dubious pieces of code:

[ 10%] Building CXX object CMakeFiles/FlashMQ.dir/utils.cpp.o
/tmp/FlashMQ/utils.cpp:276:30: warning: loop variable 'c' of type 'const unsigned char &' binds to a temporary constructed from type '__gnu_cxx::__normal_iterator<char *, std::vector<char>>::re
ference' (aka 'char &') [-Wrange-loop-construct]
    for(const unsigned char &c : buf)
                             ^
/tmp/FlashMQ/utils.cpp:276:9: note: use non-reference type 'unsigned char' to make construction explicit or type 'const char &' to prevent copying
    for(const unsigned char &c : buf)
        ^~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 13%] Building CXX object CMakeFiles/FlashMQ.dir/threaddata.cpp.o
/tmp/FlashMQ/threaddata.cpp:52:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
    const char *c_str = threadName.str().c_str();
                        ^~~~~~~~~~~~~~~~
1 warning generated.

This is just FYI, I have no fixes for them.

halfgaar commented 3 years ago

Because I rewrote your branch's history, Github lost track, but the PR has been merged, with my Travis badge. In fact, I took the entire branch. I did not test the rdynamic clang thing, but I'll it looks good enough. I need -rdynamic because I use dlopen().

There must be a CMAKE one-liner to link in all symbols though, regardless of compiler...? Anyway, I may revisit it later.

As for OSX: if porting epoll to kqueue is the only change, I'm for a BSD version. I'm not going to make a Windows version, because porting to IO Completion ports is hard. People can use WSL. Or just use Mosquitto. My intended use case for FlashMQ is servers anyway.

I also committed likely fixes for those Clang 12 warnings.

quinox commented 3 years ago

Because I rewrote your branch's history, Github lost track, but the PR has been merged, with my Travis badge.

👍🏽

I also committed likely fixes for those Clang 12 warnings.

I can confirm that Clang 12 compiles without warnings now.