diff mbox series

[ovs-dev,4/6] Fixes for build with extra warnings

Message ID 20200706082013.27446-5-anton.ivanov@cambridgegreys.com
State Changes Requested
Headers show
Series [ovs-dev,1/6] Make polling fds persistent | expand

Commit Message

Anton Ivanov July 6, 2020, 8:20 a.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 lib/byteq.c | 14 +++++++-------
 lib/byteq.h | 12 ++++++------
 2 files changed, 13 insertions(+), 13 deletions(-)

Comments

0-day Robot July 6, 2020, 9:09 a.m. UTC | #1
Bleep bloop.  Greetings Anton Ivanov, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


build:
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib    -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow -Werror -Werror   -g -O2 -MT lib/async-append-aio.lo -MD -MP -MF $depbase.Tpo -c -o lib/async-append-aio.lo lib/async-append-aio.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow -Werror -Werror -g -O2 -MT lib/async-append-aio.lo -MD -MP -MF lib/.deps/async-append-aio.Tpo -c lib/async-append-aio.c -o lib/async-append-aio.o
lib/async-append-aio.c: In function 'async_append_is_full':
lib/async-append-aio.c:83:13: error: passing argument 1 of 'byteq_is_full' discards 'const' qualifier from pointer target type [-Werror]
             || byteq_is_full(&ap->byteq));
             ^
In file included from lib/async-append-aio.c:28:0:
lib/byteq.h:40:6: note: expected 'struct byteq *' but argument is of type 'const struct byteq *'
 bool byteq_is_full(struct byteq *);
      ^
lib/async-append-aio.c: In function 'async_append_is_empty':
lib/async-append-aio.c:89:5: error: passing argument 1 of 'byteq_is_empty' discards 'const' qualifier from pointer target type [-Werror]
     return byteq_is_empty(&ap->byteq);
     ^
In file included from lib/async-append-aio.c:28:0:
lib/byteq.h:39:6: note: expected 'struct byteq *' but argument is of type 'const struct byteq *'
 bool byteq_is_empty(struct byteq *);
      ^
cc1: all warnings being treated as errors
make[2]: *** [lib/async-append-aio.lo] Error 1
make[2]: Leaving directory `/var/lib/jenkins/jobs/0day_robot_upstream_build_from_pw/workspace'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/lib/jenkins/jobs/0day_robot_upstream_build_from_pw/workspace'
make: *** [all] Error 2


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/byteq.c b/lib/byteq.c
index da40c2530..8a7b4f1dc 100644
--- a/lib/byteq.c
+++ b/lib/byteq.c
@@ -38,16 +38,16 @@  byteq_init(struct byteq *q, uint8_t *buffer, size_t size)
 
 /* Returns the number of bytes current queued in 'q'. */
 int
-byteq_used(const struct byteq *q)
+byteq_used(struct byteq *q)
 {
-    int retval;
+    atomic_int retval;
     atomic_read_relaxed(&q->used, &retval);
     return retval;
 }
 
 /* Returns the number of bytes that can be added to 'q' without overflow. */
 int
-byteq_avail(const struct byteq *q)
+byteq_avail(struct byteq *q)
 {
     return q->size - byteq_used(q);
 }
@@ -55,7 +55,7 @@  byteq_avail(const struct byteq *q)
 /* Returns true if no bytes are queued in 'q',
  * false if at least one byte is queued.  */
 bool
-byteq_is_empty(const struct byteq *q)
+byteq_is_empty(struct byteq *q)
 {
     return !byteq_used(q);
 }
@@ -63,7 +63,7 @@  byteq_is_empty(const struct byteq *q)
 /* Returns true if 'q' has no room to queue additional bytes,
  * false if 'q' has room for at least one more byte.  */
 bool
-byteq_is_full(const struct byteq *q)
+byteq_is_full(struct byteq *q)
 {
     return !byteq_avail(q);
 }
@@ -158,7 +158,7 @@  byteq_read(struct byteq *q, int fd)
 /* Returns the number of contiguous bytes of in-use space starting at the tail
  * of 'q'. */
 int
-byteq_tailroom(const struct byteq *q)
+byteq_tailroom(struct byteq *q)
 {
     int used = byteq_used(q);
     int tail_to_end = q->size - (q->tail & (q->size - 1));
@@ -195,7 +195,7 @@  byteq_head(struct byteq *q)
 /* Returns the number of contiguous bytes of free space starting at the head
  * of 'q'. */
 int
-byteq_headroom(const struct byteq *q)
+byteq_headroom(struct byteq *q)
 {
     int avail = byteq_avail(q);
     int head_to_end = q->size - (q->head & (q->size - 1));
diff --git a/lib/byteq.h b/lib/byteq.h
index 5078dd7a4..0128f2f1d 100644
--- a/lib/byteq.h
+++ b/lib/byteq.h
@@ -34,10 +34,10 @@  struct byteq {
 };
 
 void byteq_init(struct byteq *, uint8_t *buffer, size_t size);
-int byteq_used(const struct byteq *);
-int byteq_avail(const struct byteq *);
-bool byteq_is_empty(const struct byteq *);
-bool byteq_is_full(const struct byteq *);
+int byteq_used(struct byteq *);
+int byteq_avail(struct byteq *);
+bool byteq_is_empty(struct byteq *);
+bool byteq_is_full(struct byteq *);
 void byteq_put(struct byteq *, uint8_t c);
 void byteq_putn(struct byteq *, const void *, size_t n);
 void byteq_put_string(struct byteq *, const char *);
@@ -46,9 +46,9 @@  int byteq_write(struct byteq *, int fd);
 int byteq_read(struct byteq *, int fd);
 
 uint8_t *byteq_head(struct byteq *);
-int byteq_headroom(const struct byteq *);
+int byteq_headroom(struct byteq *);
 void byteq_advance_head(struct byteq *, unsigned int n);
-int byteq_tailroom(const struct byteq *);
+int byteq_tailroom(struct byteq *);
 const uint8_t *byteq_tail(const struct byteq *);
 void byteq_advance_tail(struct byteq *, unsigned int n);