SvarDOS / bugz

SvarDOS bug tracker
http://svardos.org/
6 stars 0 forks source link

TLUMACZ: IA16-GCC compiler warnings #133

Closed boeckmann closed 1 month ago

boeckmann commented 1 month ago
svarlang/tlumacz.c: In function 'svl_write_lang':
svarlang/tlumacz.c:532:60: warning: pointer targets in passing argument 3 of 'mvcomp' differ in signedness [-Wpointer-sign]
  532 |     comp_bytes = mvcomp(compstrings, sizeof(compstrings), l->strings, &stringslen, &mvcompbytesahead);
      |                                                           ~^~~~~~~~~
      |                                                            |
      |                                                            char *
svarlang/tlumacz.c:407:82: note: expected 'const unsigned char *' but argument is of type 'char *'
  407 | static unsigned short mvcomp(void *dstbuf, size_t dstbufsz, const unsigned char *src, size_t *len, unsigned short *maxbytesahead) {
      |                                                             ~~~~~~~~~~~~~~~~~~~~~^~~
svarlang/tlumacz.c: In function 'main':
svarlang/tlumacz.c:328:11: warning: 'maxid_line' may be used uninitialized in this function [-Wmaybe-uninitialized]
  328 |           printf("WARNING:%s[#%u] file unsorted - line %u has higher id %u.%u\n", fname, linecount, maxid_line, maxid >> 8, maxid & 0xff);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
svarlang/tlumacz.c:275:31: note: 'maxid_line' was declared here
  275 |   unsigned short id, maxid=0, maxid_line, linecount;
      |                               ^~~~~~~~~~
boeckmann commented 1 month ago

This is from the FDISK GCC build action https://github.com/FDOS/fdisk/actions/runs/11297256887/job/31423797458

mateuszviste commented 1 month ago

Pointer signedness difference is of no consequence and the maxid_line warning is incorrect (maxid_line really cannot be used uninitialized). It's good to know that gcc does not find any real issues. :)

boeckmann commented 1 month ago

Yes. Only wanted to inform you in case you want to silence the warnings to make it "look better" :) ...

mateuszviste commented 1 month ago

yes yes, I will look at it, but next week. even if it's not very productive, it's always better to have no compiler warnings - if only to avoid missing a more serious warning, should one pop out one day.

mateuszviste commented 1 month ago

gcc should be happy now