tezc / sc

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

sc_sock: fix compiler warnings for Windows #127

Closed svladykin closed 8 months ago

svladykin commented 8 months ago
codecov[bot] commented 8 months ago

Codecov Report

Merging #127 (e0188e7) into master (e7134b7) will not change coverage. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/tezc/sc/pull/127/graphs/tree.svg?width=650&height=150&src=pr&token=O8ZHQ0XZ30&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan)](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan) ```diff @@ Coverage Diff @@ ## master #127 +/- ## ======================================= Coverage 99.81% 99.81% ======================================= Files 21 21 Lines 2195 2195 Branches 388 388 ======================================= Hits 2191 2191 Misses 1 1 Partials 3 3 ``` | [Files](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan) | Coverage Δ | | |---|---|---| | [socket/sc\_sock.c](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan#diff-c29ja2V0L3NjX3NvY2suYw==) | `99.19% <100.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan). Last update [e7134b7...e0188e7](https://app.codecov.io/gh/tezc/sc/pull/127?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ozan+Tezcan).
tezc commented 8 months ago

Hey @svladykin, hope you are doing well! Any idea why we don't see these warnings on CI? Maybe we need to compile release version to see it?

svladykin commented 8 months ago

I guess this is because we don't have any of these flags enabled for Windows:

if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra -pedantic -pthread -Werror")
endif ()

Not sure if they will actually work for MSVC though.

I experimented with cross-compilation for Windows on Linux:

This PR is based on Mingw and Zig CC output.

tezc commented 8 months ago

Ok, I'll take a look that later.