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

Pending warnings to fix #1113

Open
lars18th opened this issue May 31, 2023 · 8 comments
Open

Pending warnings to fix #1113

lars18th opened this issue May 31, 2023 · 8 comments

Comments

@lars18th
Copy link
Contributor

FYI,

Compiling with zig cc and EMBEDDED=1 :

[...]

utils.c:241:11: warning: unused variable 'array' [-Wunused-variable]
    void *array[10];
          ^
utils.c:242:12: warning: unused variable 'size' [-Wunused-variable]
    size_t size;
           ^
utils.c:243:12: warning: unused variable 'i' [-Wunused-variable]
    size_t i;
           ^
utils.c:860:32: warning: unknown warning group '-Wstringop-truncation', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wstringop-truncation"
                               ^
4 warnings generated.

[...]

pmt.c:644:12: warning: variable 'dcw' set but not used [-Wunused-but-set-variable]
    int i, dcw = 0;
           ^
pmt.c:72:20: warning: unused function 'get_cw' [-Wunused-function]
static inline SCW *get_cw(int id) {
                   ^
pmt.c:131:19: warning: unused function 'get_streamid' [-Wunused-function]
static inline int get_streamid(uint8_t *b) {
                  ^
pmt.c:139:24: warning: unused function 'get_pts_dts' [-Wunused-function]
static inline uint64_t get_pts_dts(uint8_t *b) {
                       ^
4 warnings generated.

[...]

tables.c:390:34: warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
            ca[i].op->ca_close_ca(&ca[i]);
                                 ^
1 warning generated.
@Jalle19
Copy link
Collaborator

Jalle19 commented May 31, 2023

We should consider turning warnings into errors and fix everything

@lars18th
Copy link
Contributor Author

lars18th commented Jun 1, 2023

We should consider turning warnings into errors and fix everything

This could have sense in the testing phase of the workflow build.yml, right? So, we can add more compilers to check them.

Anyway, you want to fix these small warnings?

@Jalle19
Copy link
Collaborator

Jalle19 commented Jun 1, 2023

This could have sense in the testing phase of the workflow build.yml, right? So, we can add more compilers to check them.
Basically, yes.
Anyway, you want to fix these small warnings?
Sure why not

@lars18th
Copy link
Contributor Author

lars18th commented Jun 1, 2023

More warnings,

In this case with GCC 12.2 running inside the Docker image builder for ARM target

In file included from utils.h:5,
                 from utils.c:24:
utils.c: In function 'myrealloc':
utils/logging/logging.h:38:13: warning: pointer 'p' may be used after 'realloc' [-Wuse-after-free]
   38 |             _log(__FILE__, __LINE__, a, ##__VA_ARGS__);                        \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utils/logging/logging.h:41:22: note: in expansion of macro 'LOGL'
   41 | #define LOGM(a, ...) LOGL(DEFAULT_LOG, a, ##__VA_ARGS__)
      |                      ^~~~
utils.c:388:5: note: in expansion of macro 'LOGM'
  388 |     LOGM("%s:%d allocation_wrapper realloc allocated %d bytes from %p -> %p", f,
      |     ^~~~
utils.c:385:15: note: call to 'realloc' here
  385 |     void *x = realloc(p, a);
      |               ^~~~~~~~~~~~~

@lars18th lars18th changed the title Pending warning to resolve Pending warnings to fix Jun 1, 2023
@lars18th
Copy link
Contributor Author

lars18th commented Jun 1, 2023

These detected compiling with GCC 12.2 for MIPS:

utils.c: In function 'print_trace':
utils.c:246:5: warning: implicit declaration of function 'backtrace' [-Wimplicit-function-declaration]
     size = backtrace(array, 10);
     ^
utils.c: In function '_strncpy':
utils.c:860:9: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
 #pragma GCC diagnostic ignored "-Wstringop-truncation"
         ^

[...]

satipc.c: In function 'satipc_read':
satipc.c:688:12: warning: missing braces around initializer [-Wmissing-braces]
     struct mmsghdr messages[MAX_RTP_MSG] = {0};
            ^
satipc.c:688:12: warning: (near initialization for 'messages[0]') [-Wmissing-braces]
satipc.c:690:9: warning: missing braces around initializer [-Wmissing-braces]
         0}; // RTP Header + Payload (up to 1316 bytes) for each UDP datagram
         ^
satipc.c:690:9: warning: (near initialization for 'iovs[0]') [-Wmissing-braces]

@lars18th
Copy link
Contributor Author

lars18th commented Jun 1, 2023

I feel some of the warnings doesn't have sense to fix, because it complicates the code and they aren't errors. However, if someone wants to update the code then no problem. I've fixed some in the PR #1115

@lars18th
Copy link
Contributor Author

Hi @catalinii ,

Please, review your change of 8d33e93 becuase it has broken the automatic checking of patches, like this https://github.com/catalinii/minisatip/actions/runs/5242026172/jobs/9464892586?pr=1119 .

Thank you.

@catalinii
Copy link
Owner

I hope to fix the binaries generation with zig in max 1 werk

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

3 participants