[tin-dev] [PATCH] compiler warnings
Dennis Preiser
dennis at d--p.de
Mon Nov 20 20:26:29 CET 2023
The following warnings could be silenced with the patch below.
| ./art.c:882:7: warning: cast from 'char *' to 'struct t_hashnode *' increases required alignment from 1 to 8 [-Wcast-align]
| ./refs.c:982:7: warning: cast from 'char *' to 'struct t_hashnode *' increases required alignment from 1 to 8 [-Wcast-align]
| ./color.c:135:29: warning: implicit conversion loses integer precision: 'int' to 'short' [-Wimplicit-int-conversion]
| ./color.c:135:21: warning: implicit conversion loses integer precision: 'int' to 'short' [-Wimplicit-int-conversion]
| ./color.c:135:15: warning: implicit conversion loses integer precision: 'int' to 'short' [-Wimplicit-int-conversion]
| ./nntplib.c:267:14: warning: unused parameter 'cservice' [-Wunused-parameter]
| ./rfc2047.c:886:9: warning: unused parameter 'ismail' [-Wunused-parameter]
Dennis
--- a/src/art.c
+++ b/src/art.c
@@ -879,7 +879,7 @@ thread_by_subject(
/*
* Get the contents of the magic marker in the hashnode
*/
- h = (struct t_hashnode *) (arts[i].subject - sizeof(int) - sizeof(void *)); /* FIXME: cast increases required alignment of target type */
+ h = (void *) (arts[i].subject - sizeof(int) - sizeof(void *));
j = h->aptr;
--- a/src/color.c
+++ b/src/color.c
@@ -132,7 +132,7 @@ set_colors(
p->pair = pair = nextpair;
p->link = list;
list = p;
- init_pair(pair, fcolor, bcolor);
+ init_pair((short) pair, (short) fcolor, (short) bcolor);
} else {
pair = 0;
}
--- a/src/nntplib.c
+++ b/src/nntplib.c
@@ -293,6 +293,11 @@ server_init(
# endif /* INET6 */
# endif /* DECNET */
+# ifdef INET6
+ /* silence compiler warning (unused parameter) */
+ (void) cservice;
+# endif /* INET6 */
+
if (sock_fd < 0)
return sock_fd;
--- a/src/refs.c
+++ b/src/refs.c
@@ -979,7 +979,7 @@ collate_subjects(
/*
* Get the contents of the magic marker in the hashnode
*/
- h = (struct t_hashnode *) (arts[i].subject - sizeof(int) - sizeof(void *)); /* FIXME: cast increases required alignment of target type */
+ h = (void *) (arts[i].subject - sizeof(int) - sizeof(void *));
j = h->aptr;
if (j != -1 && j < i) {
--- a/src/rfc2047.c
+++ b/src/rfc2047.c
@@ -894,6 +894,8 @@ rfc1522_encode(
*/
#ifdef MIME_BREAK_LONG_LINES
t_bool break_long_line = TRUE;
+ /* silence compiler warning (unused parameter) */
+ (void) ismail;
#else
/*
* Even if MIME_BREAK_LONG_LINES is NOT defined, long headers in mail
More information about the tin-dev
mailing list