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 tidy #12322

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Add clang tidy #12322

wants to merge 2 commits into from

Conversation

regit
Copy link
Contributor

@regit regit commented Dec 27, 2024

This patchset adds a .clang-tidy file. It will be used by clangd to provide additional diagnostics in the code.

Some of the warnings especially the ones about using magic number are quite verbose but this may be a good idea to implement fixes to improve the situation.

Contribution style:

Our Contribution agreements:

Changes (if applicable):

Link to ticket: https://redmine.openinfosecfoundation.org/issues/3837

Describe changes:

  • Add clang-tidy file
  • Fix a thread safety warning to be able to use concurrency checks

By adding this file, code analysis by clang-tidy is now available
in LSP compatible editor using clangd.

The CustomFunctions option that adds Suricata banned functions in the
error list is only available with the (at the time of writing) future
clang 20.

Ticket: 3837
@regit regit requested review from victorjulien and a team as code owners December 27, 2024 08:19
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 83.17%. Comparing base (6f937c7) to head (0132180).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12322      +/-   ##
==========================================
- Coverage   83.26%   83.17%   -0.09%     
==========================================
  Files         912      912              
  Lines      257643   257643              
==========================================
- Hits       214521   214292     -229     
- Misses      43122    43351     +229     
Flag Coverage Δ
fuzzcorpus 61.14% <0.00%> (+<0.01%) ⬆️
livemode 19.40% <0.00%> (+<0.01%) ⬆️
pcap 44.44% <0.00%> (+0.02%) ⬆️
suricata-verify 62.81% <0.00%> (-0.05%) ⬇️
unittests 59.19% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24053

The exit() function is not thread safe and triggers a warning from
clang tidy for all FatalError() and FatalErrorAtInit() calls.

This patch uses quick_exit instead to only flush the critical IO
and not call the static destructors (which are the non thread safe
part).
@regit
Copy link
Contributor Author

regit commented Dec 27, 2024

There is a build issue on non Linux. Cooking a fix.

@regit regit marked this pull request as draft December 27, 2024 20:49
@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPW2_autofp_stats_chk
.flow.end.tcp_state.last_ack 0 1 -

Pipeline 24055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants