mirror of https://github.com/ARMmbed/mbed-os.git
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) |
||
---|---|---|
.. | ||
connectivity | ||
drivers | ||
events | ||
hal | ||
platform | ||
rtos | ||
storage | ||
ATHandler_stub.h | ||
AT_CellularDevice_stub.h | ||
AT_CellularNetwork_stub.h | ||
BlockDevice_mock.h | ||
CMakeLists.txt | ||
CellularDevice_stub.h | ||
CellularStateMachine_stub.h | ||
CellularUtil_stub.h | ||
ConditionVariable_stub.h | ||
ControlPlane_netif_stub.h | ||
EMAC_mock.h | ||
EmulatedSD.h | ||
EventQueue_stub.h | ||
FileHandle_stub.h | ||
LoRaMacCommand_stub.h | ||
LoRaMacCrypto_stub.h | ||
LoRaMac_stub.h | ||
LoRaPHY_stub.h | ||
LoRaWANTimer_stub.h | ||
NetworkStack_stub.h | ||
OnboardNetworkStack_mock.h | ||
Semaphore_stub.h | ||
Thread_stub.h | ||
aes_stub.h | ||
cipher_stub.h | ||
cmac_stub.h | ||
equeue_stub.h | ||
mbed_poll_stub.h |