tezc / sc

Common libraries and data structures for C.
BSD 3-Clause "New" or "Revised" License
2.26k stars 245 forks source link

Compile errors on Release #44

Closed rafaeldelboni closed 3 years ago

rafaeldelboni commented 3 years ago

I'm having some errors when compiling this project as Release:

Steps to reproduce

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j

Errors log:

stderr.txt

I would like to give the credit to @lucascebertin that point out this "bug"

rafaeldelboni commented 3 years ago

If I change these lines if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")

To this: if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC" AND SC_BUILD_TEST)

I can disable this behavior from my build, but this is a good solution?

tezc commented 3 years ago

We shouldn't build tests in release mode because libs won't be testable thoroughly without some tricks compiler provides in debug mode. e.g testing return value of malloc, system calls etc.

How about something like this : https://github.com/tezc/sc/pull/45/files. Here we build tests only on Debug build.

I didn't expect anybody use my messy cmakefiles, all started from it, sorry about that :) We have some tests for release mode actually that we use in our projects but I need to clean them up and then merge to this repo. It may take some time though.

rafaeldelboni commented 3 years ago

Thanks for the super-duper fast response and sorry for not making the intended use of your repo! :grimacing:

Is looking good, just made a comment about a still going warning on sc_thread.c, besides that, is looking good!

tezc commented 3 years ago

I should've written "closes" I guess :)

rafaeldelboni commented 3 years ago

I should've written "closes" I guess :)

Yes or you could set Linked pull requests in the menu on the right :robot:

rafaeldelboni commented 3 years ago

Mind making a new release?

tezc commented 3 years ago

Done : https://github.com/tezc/sc/releases/tag/v1.0.1