Bug 1297 - Various gcc 8 compiler warnings
Summary: Various gcc 8 compiler warnings
Status: RESOLVED FIXED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Other (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-06 20:27 CEST by Uwe Hermann
Modified: 2020-05-02 17:18 CEST (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Hermann 2018-10-06 20:27:01 CEST
There's a bunch of compiler warnings left in libsigrok with gcc 8. Not sure whether we can fix them all inside libsigrok, or whether upstream lib fixes will be required.

  CC       src/session.lo
../src/session.c: In function ‘fd_source_dispatch’:
../src/session.c:130:11: warning: cast between incompatible function types from ‘GSourceFunc’ {aka ‘int (*)(void *)’} to ‘int (*)(int,  int,  void *)’ [-Wcast-function-type]
  keep = (*(sr_receive_data_callback)callback)
           ^
../src/session.c: In function ‘sr_session_fd_source_add’:
../src/session.c:1203:32: warning: cast between incompatible function types from ‘sr_receive_data_callback’ {aka ‘int (*)(int,  int,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
  g_source_set_callback(source, (GSourceFunc)cb, cb_data, NULL);
                                ^
  CC       src/scpi/vxi_clnt.lo
In file included from /usr/include/rpc/rpc.h:48,
                 from ../src/scpi/vxi.h:11,
                 from ../src/scpi/vxi_clnt.c:7:
../src/scpi/vxi_clnt.c: In function ‘destroy_intr_chan_1’:
../src/scpi/vxi_clnt.c:245:3: warning: cast between incompatible function types from ‘bool_t (*)(void)’ {aka ‘int (*)(void)’} to ‘bool_t (*)(XDR *, void *, ...)’ {aka ‘int (*)(struct XDR *, void *, ...)’} [-Wcast-function-type]
   (xdrproc_t) xdr_void, (caddr_t) argp,
   ^
../src/scpi/vxi_clnt.c: In function ‘device_intr_srq_1’:
../src/scpi/vxi_clnt.c:261:3: warning: cast between incompatible function types from ‘bool_t (*)(void)’ {aka ‘int (*)(void)’} to ‘bool_t (*)(XDR *, void *, ...)’ {aka ‘int (*)(struct XDR *, void *, ...)’} [-Wcast-function-type]
   (xdrproc_t) xdr_void, (caddr_t) &clnt_res,
   ^
  CC       src/scpi/scpi_usbtmc_libusb.lo
../src/usb.c: In function ‘usb_source_dispatch’:
../src/usb.c:142:11: warning: cast between incompatible function types from ‘GSourceFunc’ {aka ‘int (*)(void *)’} to ‘int (*)(int,  int,  void *)’ [-Wcast-function-type]
  keep = (*(sr_receive_data_callback)callback)(-1, revents, user_data);
           ^
../src/usb.c: In function ‘usb_source_add’:
../src/usb.c:459:32: warning: cast between incompatible function types from ‘sr_receive_data_callback’ {aka ‘int (*)(int,  int,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Wcast-function-type]
  g_source_set_callback(source, (GSourceFunc)cb, cb_data, NULL);
                                ^
  GEN      bindings/python/timestamp
sigrok/core/classes_wrap.cpp: In function ‘void SWIG_Python_addvarlink(PyObject*, char*, PyObject* (*)(), int (*)(PyObject*))’:
sigrok/core/classes_wrap.cpp:61278:16: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
         strncpy(gv->name,name,size);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
sigrok/core/classes_wrap.cpp:61275:27: note: length computed here
       size_t size = strlen(name)+1;
                     ~~~~~~^~~~~~
Comment 1 Uwe Hermann 2020-05-02 17:18:48 CEST
Fixed in 6cfc6c5c7a2fbb8be10b282b0b2bfe9ce9653984, thanks!