fake-input-accelerometer: Expand warn_unused_result check
With CPPFLAGS='-D_FORTIFY_SOURCE=2' ./configure we otherwise fail like fake-input-accelerometer.c:90:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] 90 | (void)write (data->uinput, &ev, sizeof(ev)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fake-input-accelerometer.c:94:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] 94 | (void)write (data->uinput, &ev, sizeof(ev)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fake-input-accelerometer.c:98:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] 98 | (void)write (data->uinput, &ev, sizeof(ev)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fake-input-accelerometer.c:104:9: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] 104 | (void) write (data->uinput, &ev, sizeof(ev)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The '!' trick is from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34 Closes: #248
This commit is contained in:

committed by
Bastien Nocera

parent
3694cd3101
commit
1d56dca339
@@ -87,21 +87,21 @@ send_uinput_event (OrientationData *data)
|
||||
ev.type = EV_ABS;
|
||||
ev.code = ABS_X;
|
||||
ev.value = data->accel_x;
|
||||
(void) write (data->uinput, &ev, sizeof(ev));
|
||||
(void) !write (data->uinput, &ev, sizeof(ev));
|
||||
|
||||
ev.code = ABS_Y;
|
||||
ev.value = data->accel_y;
|
||||
(void) write (data->uinput, &ev, sizeof(ev));
|
||||
(void) !write (data->uinput, &ev, sizeof(ev));
|
||||
|
||||
ev.code = ABS_Z;
|
||||
ev.value = data->accel_z;
|
||||
(void) write (data->uinput, &ev, sizeof(ev));
|
||||
(void) !write (data->uinput, &ev, sizeof(ev));
|
||||
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
gettimeofday(&ev.time, NULL);
|
||||
ev.type = EV_SYN;
|
||||
ev.code = SYN_REPORT;
|
||||
(void) write (data->uinput, &ev, sizeof(ev));
|
||||
(void) !write (data->uinput, &ev, sizeof(ev));
|
||||
|
||||
if (!data->uinput_dev)
|
||||
data->uinput_dev = setup_uinput_udev (data->client);
|
||||
|
Reference in New Issue
Block a user