[Tuxpaint-devel] Almost all compiler warnings addressed!
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Bill K. <nb...@so...> - 2021-10-24 08:31:55
|
I've cleaned up a bunch of code here and there that were
throwing warnings when I compile Tux Paint, and am down
to just the following...
When I build Tux Paint (make clean && make) from Git master
on my Ubuntu 20.04.3 LTS system, which comes with
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, I now only get
these warnings:
In file included from /usr/include/string.h:495,
from src/tuxpaint.c:182:
In function ‘strncpy’,
inlined from ‘trash’ at src/tuxpaint.c:26826:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 255 bytes from a string of length 255 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and:
src/parse.gperf: In function ‘parse_one_option’:
src/parse.gperf:306:45: warning: argument to ‘sizeof’ in ‘memcpy’ call is the same pointer type ‘char *’ as the destination; expected ‘char’ or an explicit length [-Wsizeof-pointer-memaccess]
306 | memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); /* FIXME: This causes a warning; should it be 'sizeof(char)', or do we need to have the warning suppressed? -bjk 2021.10.14 */
| ^~~~
I'm hesitant to mess with either of them (especially at 1:30am
in the morning :) ), so I'm going to leave it at that, for now.
Any assistance from better-at-C-than-me folks would be appreciated!
And of course, let me know whether any of my tweaks this evening
had unintended consiquences for anyone!
Off to bed,
--
-bill!
Sent from my computer
|