roc-streaming / openfec

Unofficial OpenFEC fork with various bugfixes.
https://openfec.inrialpes.fr
Other
13 stars 11 forks source link

1.4.2.5: compile time warnings #16

Closed kloczek closed 1 year ago

kloczek commented 1 year ago

First summary stats

[tkloczko@pers-jacek SPECS]$ rpmbuild -ba openfec.spec --quiet 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
     10 -Wunused-variable
      9 -Wunused-but-set-variable
      8 -Wunused-result
      4 -Wunused-const-variable=
      3 -Wunused-label
      1 -Wparentheses

and extracted stderr

```console /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_hamming_weight.c:45:21: warning: 'of_hff' defined but not used [-Wunused-const-variable=] 45 | static const UINT64 of_hff = 0xffffffffffffffffLL; //binary: all ones | ^~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_hamming_weight.c:44:21: warning: 'of_m32' defined but not used [-Wunused-const-variable=] 44 | static const UINT64 of_m32 = 0x00000000ffffffffLL; //binary: 32 zeros, 32 ones | ^~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_hamming_weight.c:43:21: warning: 'of_m16' defined but not used [-Wunused-const-variable=] 43 | static const UINT64 of_m16 = 0x0000ffff0000ffffLL; //binary: 16 zeros, 16 ones ... | ^~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_hamming_weight.c:42:21: warning: 'of_m8' defined but not used [-Wunused-const-variable=] 42 | static const UINT64 of_m8 = 0x00ff00ff00ff00ffLL; //binary: 8 zeros, 8 ones ... | ^~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c: In function 'of_mod2sparse_copy': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c:192:27: warning: variable 'f' set but not used [-Wunused-but-set-variable] 192 | of_mod2entry *e, *f; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_dense.c: In function 'of_mod2dense_row_weight': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_dense.c:1542:25: warning: variable 'nwords' set but not used [-Wunused-but-set-variable] 1542 | UINT32 nwords; /* number of of_mod2word in a row */ | ^~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_dense.c: In function 'of_mod2dense_row_weight_ignore_first': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_dense.c:1568:25: warning: variable 'start0' set but not used [-Wunused-but-set-variable] 1568 | UINT32 start0; | ^~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c: In function 'of_mod2sparse_print_bitmap': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c:619:25: warning: variable 'val' set but not used [-Wunused-but-set-variable] 619 | UINT32 val = 1; | ^~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c:616:25: warning: variable 'y' set but not used [-Wunused-but-set-variable] 616 | UINT32 y; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/binary_matrix/of_matrix_sparse.c:615:25: warning: variable 'x' set but not used [-Wunused-but-set-variable] 615 | UINT32 x; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/ml_decoding/of_ml_tool.c: In function 'of_linear_binary_code_col_forward_elimination': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/ml_decoding/of_ml_tool.c:165:25: warning: variable 'n' set but not used [-Wunused-but-set-variable] 165 | INT32 n, p; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c: In function 'of_rs_release_codec_instance': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c:83:16: warning: unused variable 'i' [-Wunused-variable] 83 | UINT32 i; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c: In function 'main': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:234:9: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [-Wunused-result] 234 | system(cmd); | ^~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:359:17: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result] 359 | scanf("%c", &answer); | ^~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:364:17: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result] 364 | scanf("%lf", &step);/* XXX: done this way, the user MUST enter a value */ | ^~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:409:9: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [-Wunused-result] 409 | system(cmd); | ^~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:425:9: warning: ignoring return value of 'system' declared with attribute 'warn_unused_result' [-Wunused-result] 425 | system(cmd); | ^~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c: In function 'initialize_file_names': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:456:17: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result] 456 | fgets(dirn, MAXNAMELEN, file); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tools/descr_stats_v1.2/descr_stats.c:468:17: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result] 468 | fgets(basen, MAXNAMELEN, file); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c: In function 'of_rs_finish_decoding': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c:283:25: warning: variable 'n' set but not used [-Wunused-but-set-variable] 283 | UINT32 n; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/ml_decoding/of_ml_decoding.c: In function 'of_linear_binary_code_create_simplified_linear_system': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_common/linear_binary_codes_utils/ml_decoding/of_ml_decoding.c:523:26: warning: unused variable '__pchk_matrix_simplified_cols' [-Wunused-variable] 523 | of_mod2sparse *__pchk_matrix_simplified_cols; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/of_reed-solomon_gf_2_m_api.c: In function 'of_rs_2_m_finish_decoding': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/of_reed-solomon_gf_2_m_api.c:376:25: warning: variable 'n' set but not used [-Wunused-but-set-variable] 376 | UINT32 n; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/of_galois_field_code.c: In function 'of_rs_2m_build_encoding_matrix': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/of_galois_field_code.c:193:9: warning: label 'error' defined but not used [-Wunused-label] 193 | error: | ^~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/of_galois_field_code.c: In function 'of_rs_2m_build_decoding_matrix': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/of_galois_field_code.c:252:1: warning: label 'error' defined but not used [-Wunused-label] 252 | error: | ^~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/algebra_2_4.c: In function 'of_galois_field_2_4_addmul1_compact': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/algebra_2_4.c:43:85: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses] 43 | #define GF_ADDMULC_COMPACT(dst,x) {dst = (dst>>4 ^ __gf_mulc_[x>>4])<<4 |(dst & 0x0F ^ __gf_mulc_[x & 0x0F]); } | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/src/lib_stable/reed-solomon_gf_2_m/galois_field_codes_utils/algebra_2_4.c:280:17: note: in expansion of macro 'GF_ADDMULC_COMPACT' 280 | GF_ADDMULC_COMPACT (*dst , *src); | ^~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/create_instance_test.c: In function 'main': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/create_instance_test.c:107:1: warning: label 'error' defined but not used [-Wunused-label] 107 | error: | ^~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c: In function 'main': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c:75:27: warning: unused variable 'encoding_symb_tab' [-Wunused-variable] 75 | void **encoding_symb_tab; | ^~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c:74:27: warning: unused variable 'orig_symb_tab' [-Wunused-variable] 74 | char **orig_symb_tab; | ^~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c:71:25: warning: unused variable 'esi' [-Wunused-variable] 71 | UINT32 esi; | ^~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c:67:28: warning: unused variable 'j' [-Wunused-variable] 67 | UINT32 i, j; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/tests/code_params_test.c:67:25: warning: unused variable 'i' [-Wunused-variable] 67 | UINT32 i, j; | ^ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/eperftool/tx_simulator.c: In function 'init_prng_with_seed': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/eperftool/tx_simulator.c:629:25: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] 629 | fread(&seed, sizeof(int), 1, dev_random); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/howto_examples/simple_client_server/simple_client.c: In function 'main': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/howto_examples/simple_client_server/simple_client.c:93:25: warning: unused variable 'dst_host' [-Wunused-variable] 93 | SOCKADDR_IN dst_host; | ^~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/howto_examples/simple_client_server/simple_client.c:85:25: warning: unused variable 'symb_sz_32' [-Wunused-variable] 85 | UINT32 symb_sz_32 = SYMBOL_SIZE / 4; /* symbol size in units of 32 bit words */ | ^~~~~~~~~~ /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/eperftool/sender.c: In function 'encode': /home/tkloczko/rpmbuild/BUILD/openfec-1.4.2.5/applis/eperftool/sender.c:261:25: warning: unused variable 'i' [-Wunused-variable] 261 | UINT32 i; | ^ ```
gavv commented 1 year ago

Hi! Do you know where do this flags originate from? IIRC we don't set them in cmake.

kloczek commented 1 year ago

These are not flags but types of reported warnings.

kloczek commented 1 year ago

Please have look one more time on extracted stderr output in second block of the tex of the report 😄

gavv commented 1 year ago

Hi,

These warnings seem to be enabled by -Wall. However, in cmake, we don't enable these warnings individually (like -Wunused-variable), nor do we set broader flags like -Weverything/-Wall/-Wextra.

I haven't used rpm-based distros. I tried to run Fedora in docker and run rpm-build inside it. I did not see these warnings there.

That's why I wonder, where and why they are enabled?

Note that this a low-maintenance fork with focus on fixing critical bugs. Are these warnings actually a problem? I'd just disable them.

kloczek commented 1 year ago

`-Wall is passed as part of the $CFLAGS env variable. It it part of the standard flags passed in $CFLAGS/$CXXFLAGS.

gavv commented 1 year ago

I see;

So, I didn't find anything critical among these warnings: they are either syntactic problems or belong to internal tools.

I'm going to close this because of the reasons I mentioned above. I mostly avoid any refactoring and cleanup in this project without a good reason. However feel free to reopen or ping me if these warnings actually create some problem for you.