]> sigrok.org Git - libsigrok.git/commit
Fix various gcc 8 compiler warnings related to ARRAY_SIZE.
authorUwe Hermann <redacted>
Tue, 18 Sep 2018 21:21:40 +0000 (23:21 +0200)
committerUwe Hermann <redacted>
Sat, 6 Oct 2018 17:13:39 +0000 (19:13 +0200)
commit2377246220f2d48e341e5b1286a44818eab789d8
treeee1471fedb4f53a58f8d8a24e0d91d2014ad03ae
parentaf930bcf7bdf82da663dca9344f37ddfe2f25f32
Fix various gcc 8 compiler warnings related to ARRAY_SIZE.

Example:

  In file included from src/hardware/kecheng-kc-330b/protocol.h:26,
                   from src/hardware/kecheng-kc-330b/api.c:22:
  src/hardware/kecheng-kc-330b/api.c: In function ‘config_list’:
  src/libsigrok-internal.h:51:34: warning: division ‘sizeof (void *) / sizeof (void)’ does not compute the number of array elements [-Wsizeof-pointer-div]
   #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
                                    ^
  src/libsigrok-internal.h:55:32: note: in expansion of macro ‘ARRAY_SIZE’
   #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
                                  ^~~~~~~~~~
  src/libsigrok-internal.h:964:43: note: in expansion of macro ‘ARRAY_AND_SIZE’
    std_opts_config_list(key, data, sdi, cg, ARRAY_AND_SIZE(scanopts), \
                                             ^~~~~~~~~~~~~~
  src/hardware/kecheng-kc-330b/api.c:296:10: note: in expansion of macro ‘STD_CONFIG_LIST’
     return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
            ^~~~~~~~~~~~~~~
14 files changed:
src/hardware/asix-sigma/api.c
src/hardware/baylibre-acme/api.c
src/hardware/hung-chang-dso-2100/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/lecroy-logicstudio/api.c
src/hardware/lecroy-xstream/api.c
src/hardware/link-mso19/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/zeroplus-logic-cube/api.c
src/libsigrok-internal.h
src/session_driver.c
src/std.c