wdoekes / asterisk-chan-dongle

chan_dongle channel driver for Huawei UMTS cards, works with Asterisk 14+
Other
296 stars 104 forks source link

Fix a warning on an older compiler #147

Closed rojer closed 2 years ago

rojer commented 2 years ago

GCC8 generates the following warning when compiling smsdb.c

smsdb.c: In function 'smsdb_outgoing_part_status':
smsdb.c:713:18: error: 'uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (res >= 0 && smsdb_outgoing_clear_nolock(uid) < 0) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

As far as I can tell, it's wrong - there is no way res can be >= 0 and uid remain uninitialized but it seems that GCC8 is not as good at escape analysis.

Nevertheless, GCC8 is still being used by OpenWRT and this change to placate it is simple enough.

Signed-off-by: Deomid "rojer" Ryabkov rojer@rojer.me

wdoekes commented 2 years ago

Ah, I had that change pending here: https://github.com/wdoekes/asterisk-chan-dongle/commit/5837b98ec5634e1a67402934dfa6be5a3b7de662 from the add-quectel branch.

wdoekes commented 2 years ago

If you could test that branch (by adding #145 on top of it), that would be helpful to test original (non-Quectel) behaviour.

https://github.com/wdoekes/asterisk-chan-dongle/tree/add-quectel-support

I have no means (or intention) of testing any of this, so a thumbs up or down on that branch helps.

rojer commented 2 years ago

tested - builds and works fine

wdoekes commented 2 years ago

Fixed by merging the other branch.

Thanks for testing :)