mbed-os/UNITTESTS/stubs
Jaeden Amero 7f7571657e test: Fix function does not return a value warnings
Many test stub functions are meant to return a value, but weren't. Clang
would generate a warning for each instance where we weren't returning
anything in a function that was meant to return a value.

    warning: non-void function does not return a value [-Wreturn-type]

For a specific example, my_radio::time_on_air() is supposed to return a
uint32_t, but wasn't returning anything. We'll return a zero instead of
relying on undefined behavior.

Without this, clang 11.0.1 was generating a virtual function
implementation with a `ud2` instruction to abort at run-time, causing
some execution of some unit tests to abort.

    Running main() from gmock_main.cc
    [==========] Running 10 tests from 1 test suite.
    [----------] Global test environment set-up.
    [----------] 10 tests from Test_LoRaPHYUS915
    [ RUN      ] Test_LoRaPHYUS915.constructor
    [       OK ] Test_LoRaPHYUS915.constructor (0 ms)
    [ RUN      ] Test_LoRaPHYUS915.restore_default_channels
    [       OK ] Test_LoRaPHYUS915.restore_default_channels (0 ms)
    [ RUN      ] Test_LoRaPHYUS915.rx_config
    [       OK ] Test_LoRaPHYUS915.rx_config (0 ms)
    [ RUN      ] Test_LoRaPHYUS915.tx_config
    Process 35669 stopped
    * thread #1, name = 'lorawan-loraphy-', stop reason = signal SIGILL: privileged instruction
        frame #0: 0x0000000000276f73 lorawan-loraphy-us915-unittest`my_radio::time_on_air(this=0x0000000800c2b048, modem=MODEM_LORA, pkt_len='\0') at Test_LoRaPHYUS915.cpp:90:5
       87       };
       88
       89       virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len)
    -> 90       {
       91       };
       92
       93       virtual bool perform_carrier_sense(radio_modems_t modem,
    (lldb) disassemble --pc
    lorawan-loraphy-us915-unittest`my_radio::time_on_air:
    ->  0x276f73 <+67>: ud2
        0x276f75:       int3
        0x276f76:       int3
        0x276f77:       int3
    (lldb)
2021-05-27 09:38:18 +01:00
..
connectivity test: Fix function does not return a value warnings 2021-05-27 09:38:18 +01:00
drivers test: Fix function does not return a value warnings 2021-05-27 09:38:18 +01:00
events test: Fix function does not return a value warnings 2021-05-27 09:38:18 +01:00
hal CMake: Update hal and platform stub CMake linker options for coverage 2021-05-11 04:27:09 -07:00
platform CMake: Update hal and platform stub CMake linker options for coverage 2021-05-11 04:27:09 -07:00
rtos sort stubs into libraries 2021-05-11 02:29:56 -07:00
storage test: Fix function does not return a value warnings 2021-05-27 09:38:18 +01:00
ATHandler_stub.h Update netsocket header and source reference in other libraries 2020-07-23 06:22:15 -07:00
AT_CellularDevice_stub.h Cellular: Refactor get_max_socket_count() into CellularProperty 2020-01-15 23:04:00 -08:00
AT_CellularNetwork_stub.h Cellular: Add State machine unit tests. 2019-01-22 02:23:04 -08:00
BlockDevice_mock.h Unittests and Astyle: 2020-07-17 03:12:03 -07:00
CMakeLists.txt sort stubs into libraries 2021-05-11 02:29:56 -07:00
CellularDevice_stub.h Remove CellularBase and AT_CellularBase 2019-12-09 15:25:22 +02:00
CellularStateMachine_stub.h UT for CellularDevice get/set timeouts methods 2019-09-17 12:56:47 +03:00
CellularUtil_stub.h Valgrind & unittest fixes 2019-06-13 15:15:53 +03:00
ConditionVariable_stub.h Cellular: fix ATHandler destructor possible crash on delete 2019-09-03 09:09:05 +03:00
ControlPlane_netif_stub.h Update netsocket header and source reference in other libraries 2020-07-23 06:22:15 -07:00
EMAC_mock.h Update netsocket header and source reference in other libraries 2020-07-23 06:22:15 -07:00
EmulatedSD.h Unittests and Astyle: 2020-07-17 03:12:03 -07:00
EventQueue_stub.h unittests: fix astyle 2018-10-25 09:58:18 +01:00
FileHandle_stub.h test: Fix function does not return a value warnings 2021-05-27 09:38:18 +01:00
LoRaMacCommand_stub.h unittests: fix astyle 2018-10-25 09:58:18 +01:00
LoRaMacCrypto_stub.h unittests: fix astyle 2018-10-25 09:58:18 +01:00
LoRaMac_stub.h Fix UNITTESTS build failure 2020-08-14 12:32:50 +01:00
LoRaPHY_stub.h unittests: fix astyle 2018-10-25 09:58:18 +01:00
LoRaWANTimer_stub.h Fix UNITTESTS build failure 2020-08-14 12:32:50 +01:00
NetworkStack_stub.h IPCore deprecated string-based API removal 2020-02-06 11:27:49 +02:00
OnboardNetworkStack_mock.h Unittests fixed not to use deprecated string-based API 2020-02-06 11:27:50 +02:00
Semaphore_stub.h Introduce Semaphore::acquire methods 2019-05-28 17:02:06 +03:00
Thread_stub.h Fix UNITTESTS issue 2020-07-19 10:02:32 -07:00
aes_stub.h LoRaMacCrypto unittested 2018-09-27 10:49:07 +03:00
cipher_stub.h LoRaMacCrypto unittested 2018-09-27 10:49:07 +03:00
cmac_stub.h LoRaMacCrypto unittested 2018-09-27 10:49:07 +03:00
equeue_stub.h LoRaWANStack unit tested 2018-09-27 11:30:52 +03:00
mbed_poll_stub.h LoRa regions unittested, stubs licences revisited 2018-09-27 10:49:07 +03:00