Other method to avoid "unused var" compiler warnings.
The '(void)varname' method is nicer than 'varname = varname' and also prevents warnings when compiling sigrok with clang instead of gcc.
This commit is contained in:
parent
cc8a7d250c
commit
cb93f8a927
|
@ -69,8 +69,8 @@ void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
|
|||
gpointer chunk;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
in_unitsize = in_unitsize;
|
||||
probelist = probelist;
|
||||
(void)in_unitsize;
|
||||
(void)probelist;
|
||||
|
||||
if (ds->chunklist == NULL)
|
||||
chunk = new_chunk(&ds);
|
||||
|
|
|
@ -400,7 +400,7 @@ static int hw_init(const char *deviceinfo)
|
|||
struct sigma *sigma;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
deviceinfo = deviceinfo;
|
||||
(void)deviceinfo;
|
||||
|
||||
if (!(sigma = g_try_malloc(sizeof(struct sigma)))) {
|
||||
sr_err("sigma: %s: sigma malloc failed", __func__);
|
||||
|
@ -997,8 +997,9 @@ static int receive_data(int fd, int revents, void *session_data)
|
|||
uint64_t running_msec;
|
||||
struct timeval tv;
|
||||
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
|
||||
numchunks = (sigma->state.stoppos + 511) / 512;
|
||||
|
||||
|
@ -1245,7 +1246,8 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
|
|||
struct triggerinout triggerinout_conf;
|
||||
struct triggerlut lut;
|
||||
|
||||
session_data = session_data;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)session_data;
|
||||
|
||||
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
@ -1361,7 +1363,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
|
||||
sigma = sdi->priv;
|
||||
|
||||
session_data = session_data;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)session_data;
|
||||
|
||||
/* Stop acquisition. */
|
||||
sigma_set_register(WRITE_MODE, 0x11, sigma);
|
||||
|
|
|
@ -470,7 +470,7 @@ static int hw_init(const char *deviceinfo)
|
|||
sr_spew("la8: entering %s", __func__);
|
||||
|
||||
/* Avoid compiler errors. */
|
||||
deviceinfo = deviceinfo;
|
||||
(void)deviceinfo;
|
||||
|
||||
/* Allocate memory for our private driver context. */
|
||||
if (!(la8 = g_try_malloc(sizeof(struct la8)))) {
|
||||
|
@ -981,8 +981,8 @@ static int receive_data(int fd, int revents, void *session_data)
|
|||
struct la8 *la8;
|
||||
|
||||
/* Avoid compiler errors. */
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
|
||||
if (!(sdi = session_data)) {
|
||||
sr_err("la8: %s: user_data was NULL", __func__);
|
||||
|
|
|
@ -130,7 +130,7 @@ static int hw_init(const char *deviceinfo)
|
|||
struct sr_device_instance *sdi;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
deviceinfo = deviceinfo;
|
||||
(void)deviceinfo;
|
||||
|
||||
sdi = sr_device_instance_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
|
||||
if (!sdi) {
|
||||
|
@ -146,7 +146,7 @@ static int hw_init(const char *deviceinfo)
|
|||
static int hw_opendev(int device_index)
|
||||
{
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
/* Nothing needed so far. */
|
||||
|
||||
|
@ -156,7 +156,7 @@ static int hw_opendev(int device_index)
|
|||
static int hw_closedev(int device_index)
|
||||
{
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
/* Nothing needed so far. */
|
||||
|
||||
|
@ -202,7 +202,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
static int hw_get_status(int device_index)
|
||||
{
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
return SR_ST_ACTIVE;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
char *stropt;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
if (capability == SR_HWCAP_PROBECONFIG) {
|
||||
/* Nothing to do, but must be supported */
|
||||
|
@ -359,8 +359,8 @@ static int receive_data(int fd, int revents, void *session_data)
|
|||
gsize z;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
|
||||
do {
|
||||
g_io_channel_read_chars(channels[0],
|
||||
|
@ -471,8 +471,8 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
|
|||
static void hw_stop_acquisition(int device_index, gpointer session_data)
|
||||
{
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
session_data = session_data;
|
||||
(void)device_index;
|
||||
(void)session_data;
|
||||
|
||||
/* Stop generate thread. */
|
||||
thread_running = 0;
|
||||
|
|
|
@ -979,7 +979,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
struct sr_datafeed_packet packet;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
packet.type = SR_DF_END;
|
||||
sr_session_bus(session_device_id, &packet);
|
||||
|
|
|
@ -292,7 +292,7 @@ static int hw_init(const char *deviceinfo)
|
|||
int err, devcnt, i, j;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
deviceinfo = deviceinfo;
|
||||
(void)deviceinfo;
|
||||
|
||||
if (libusb_init(&usb_context) != 0) {
|
||||
sr_warn("Failed to initialize USB.");
|
||||
|
@ -554,9 +554,9 @@ static int receive_data(int fd, int revents, void *user_data)
|
|||
struct timeval tv;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
user_data = user_data;
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
(void)user_data;
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0;
|
||||
libusb_handle_events_timeout(usb_context, &tv);
|
||||
|
@ -780,7 +780,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
struct sr_datafeed_packet packet;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
device_index = device_index;
|
||||
(void)device_index;
|
||||
|
||||
packet.type = SR_DF_END;
|
||||
sr_session_bus(session_data, &packet);
|
||||
|
|
|
@ -284,7 +284,7 @@ static int hw_init(const char *deviceinfo)
|
|||
int err, devcnt, i;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
deviceinfo = deviceinfo;
|
||||
(void)deviceinfo;
|
||||
|
||||
if (libusb_init(&usb_context) != 0) {
|
||||
sr_warn("Failed to initialize USB.");
|
||||
|
|
|
@ -218,7 +218,7 @@ struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
|||
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
|
||||
{
|
||||
/* Avoid compiler warnings. */
|
||||
usb = usb;
|
||||
(void)usb;
|
||||
|
||||
/* Nothing to do for this device instance type. */
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
char *outbuf;
|
||||
|
||||
/* Prevent compiler warnings. */
|
||||
o = o;
|
||||
(void)o;
|
||||
|
||||
if (!data_in) {
|
||||
sr_warn("binary output: %s: data_in was NULL", __func__);
|
||||
|
|
|
@ -70,9 +70,9 @@ static int feed_chunk(int fd, int revents, void *session_data)
|
|||
void *buf;
|
||||
int ret, got_data;
|
||||
|
||||
/* avoid compiler warning */
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
|
||||
sr_dbg("session_driver: feed chunk");
|
||||
|
||||
|
@ -183,9 +183,8 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
|
||||
/* avoid compiler warning */
|
||||
device_index = device_index;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)device_index;
|
||||
|
||||
if (devices)
|
||||
return SR_OK;
|
||||
|
@ -238,8 +237,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
struct sr_datafeed_packet *packet;
|
||||
int err;
|
||||
|
||||
/* avoid compiler warning */
|
||||
session_device_id = session_device_id;
|
||||
/* Avoid compiler warnings. */
|
||||
(void)session_device_id;
|
||||
|
||||
if (!(vdevice = get_vdevice_by_index(device_index)))
|
||||
return SR_ERR;
|
||||
|
|
Loading…
Reference in New Issue