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

clang-tidy warnings as of 20240106 #65

Open
jj1bdx opened this issue Jan 6, 2024 · 0 comments
Open

clang-tidy warnings as of 20240106 #65

jj1bdx opened this issue Jan 6, 2024 · 0 comments

Comments

@jj1bdx
Copy link
Owner

jj1bdx commented Jan 6, 2024

Two major warning cases found on 20240106

According to CMU SEI C/C++ Coding Standards:

ERR33-C. Detect and handle standard library errors

  • Use of fprintf(stderr, ...) should be replaced by a more abstract function:
/Users/kenji/src/airspy-fmradion/main.cpp:182:3: error: the value returned by this f
unction should be used [cert-err33-c,-warnings-as-errors]
  182 |   fprintf(stderr, "ERROR: Invalid argument for %s\n", label);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kenji/src/airspy-fmradion/main.cpp:182:3: note: cast the expression to void t
o silence this warning

Also:

ERR58-CPP. Handle all exceptions thrown before main() begins executing

  • Statically-defined filter parameters of std::vector should be initialized runtime:
/Users/kenji/src/airspy-fmradion/sfmbase/FilterParameters.cpp:851:39: error: initial
ization of 'jj1bdx_fm_384kHz_narrow' with static storage duration may throw an excep
tion that cannot be caught [cert-err58-cpp,-warnings-as-errors]
  851 | const IQSampleCoeff FilterParameters::jj1bdx_fm_384kHz_narrow = {
      |                                       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:465:5:
 note: possibly throwing constructor declared here
  465 |     vector(initializer_list<value_type> __il);
      |     ^

Other cases

I also observe another warning cases because of r8brain-free-src code, but this is not really fixable in airspy-fmradion.

/Users/kenji/src/airspy-fmradion/r8brain-free-src/CDSPBlockConvolver.h:179:3: error:
 Call to virtual method 'CDSPBlockConvolver::clear' during construction bypasses vir
tual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
  179 |                 clear();
      |                 ^
/Users/kenji/src/airspy-fmradion/sfmbase/AudioResampler.cpp:27:15: note: Calling con
structor for 'CDSPResampler'
   27 |           new r8b::CDSPResampler(input_rate, output_rate, max_input_length))
 {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

No branches or pull requests

1 participant