Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clang support to edgesec #242

Merged
merged 7 commits into from
Sep 5, 2022
Merged

Add Clang support to edgesec #242

merged 7 commits into from
Sep 5, 2022

Conversation

aloisklink
Copy link
Contributor

@aloisklink aloisklink commented Aug 23, 2022

Adds initial basic support for compiling EDGESec with Clang.

Disables GNU/Clang C extensions by default on the edgesec code, except:

  • lib/libnetlink (taken from Linux kernel)
  • lib/libpcap (uses a bunch of BSD-style u_int)
  • any file that defined #_GNU_SOURCE (or similar)

Additionally, I've removed some GNU only features, like C++11-styled rawstrings.

Finally, I've added a CI job for Clang so it'll be tested. It even has code-coverage added!

C11 officially doesn't supported C++11 raw-strings.
GNU does, but this doesn't work on Clang.
Disables GNU/Clang C extension by default on all code, except:
  - lib/libnetlink (taken from Linux kernel)
  - lib/libpcap (uses a bunch of BSD-style u_int)
  - any file that defined `#_GNU_SOURCE` (or similar)
Currently, we aren't passing CC/CXX to our all of our dependencies
in `lib/`. This means that CC/CXX are just loaded from the value
of CC/CXX in our environment (not any CMake overrides
(e.g. in CMakeToolchain file).

This commit explicitly passes them.
The ubuntu-20.04 image of GitHub Actions defaults to Clang 11.
However, the only version of LLVM that can be easily installed is
LLVM 10, which is not compatible with Clang 11.
@codecov
Copy link

codecov bot commented Aug 26, 2022

Codecov Report

Merging #242 (819a174) into main (651212e) will decrease coverage by 2.18%.
The diff coverage is n/a.

❗ Current head 819a174 differs from pull request most recent head 177e015. Consider uploading reports for the commit 177e015 to get more accurate results

@@            Coverage Diff             @@
##             main     #242      +/-   ##
==========================================
- Coverage   47.95%   45.77%   -2.19%     
==========================================
  Files         110      107       -3     
  Lines       16212    16564     +352     
==========================================
- Hits         7775     7582     -193     
- Misses       8437     8982     +545     
Impacted Files Coverage Δ
src/edgesec.c 0.00% <ø> (ø)
tests/dns/test_mdns_service.c 57.14% <0.00%> (-22.86%) ⬇️
tests/capture/test_capture_service.c 61.53% <0.00%> (-9.24%) ⬇️
src/ap/hostapd.c 68.96% <0.00%> (-6.82%) ⬇️
src/utils/base64.c 71.84% <0.00%> (-6.06%) ⬇️
src/utils/os.c 40.32% <0.00%> (-5.27%) ⬇️
tests/ap/test_hostapd.c 90.76% <0.00%> (-4.15%) ⬇️
...iddlewares/cleaner_middleware/cleaner_middleware.c 14.70% <0.00%> (-3.65%) ⬇️
...ture/middlewares/pcap_middleware/pcap_middleware.c 23.18% <0.00%> (-3.26%) ⬇️
.../middlewares/header_middleware/header_middleware.c 14.94% <0.00%> (-2.63%) ⬇️
... and 91 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@aloisklink
Copy link
Contributor Author

Huh, I've got no idea why adding Clang is changing the code-coverage values by so much (maybe it calculates lines slightly differently?). But Clang seems to be working, so I'll mark this PR as ready to review!

@aloisklink aloisklink marked this pull request as ready for review August 26, 2022 08:57
@mereacre mereacre self-requested a review September 2, 2022 12:36
Copy link
Contributor

@mereacre mereacre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@aloisklink aloisklink merged commit 4162d90 into main Sep 5, 2022
@aloisklink aloisklink deleted the build/add-clang-support branch September 5, 2022 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants