]> sigrok.org Git - libsigrok.git/commit
tests: address printf format issues, spotted by clang on macos
authorGerhard Sittig <redacted>
Sat, 12 Feb 2022 14:00:44 +0000 (15:00 +0100)
committerGerhard Sittig <redacted>
Tue, 22 Feb 2022 20:53:20 +0000 (21:53 +0100)
commit11cd0ff15948a6c3999f66a6b45ace11049b09ee
treec0d0cec9147b3ce7cb370966207b4faf8bdcce3c
parentc8aa9206e91ce983c7d12108f17f462663b337fa
tests: address printf format issues, spotted by clang on macos

The sr_rational data type has int64_t and uint64_t members, but analog.c
and strutil.c source code used "%ld" and "%lu" formats. Use PRIu64 et al
instead.

  .../libsigrok/tests/strutil.c:125:14: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
                      input, rational.p, rational.q);
                             ^~~~~~~~~~
  /usr/local/Cellar/check/0.15.2/include/check.h:472:77: note: expanded from macro 'fail_unless'
      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
                                                                            ^~~~~~~~~~~

Also make test stimulus static. It's a constant vector of literals and
is exclusively used in the test routine, need not occupy stack space.
tests/analog.c
tests/strutil.c