Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up temporary error code macros added in PR#7916 #8119

Merged
merged 4 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
#### Problem
PR #7916 _Consolidate error types_ included some temporary
definitions to avoid breaking any PRs in flight.

#### Change overview

- Removed the temporary definitions.
- Updated names in recent PRs.

#### Testing

No changes to functionality.
  • Loading branch information
kpschoedel committed Jul 5, 2021
commit 28f52fdd8b4aa456206b3c7c1e2c445f9800ca2c
14 changes: 0 additions & 14 deletions src/ble/BleError.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,6 @@
* @}
*/

// !!!!! IMPORTANT !!!!!
// These definitions are present temporarily in order to reduce breakage for PRs in flight.
// TODO: remove compatibility definitions
#define BLE_ERROR CHIP_ERROR
#define BLE_NO_ERROR CHIP_NO_ERROR
#define BLE_ERROR_BAD_ARGS CHIP_ERROR_INVALID_ARGUMENT
#define BLE_ERROR_INCORRECT_STATE CHIP_ERROR_INCORRECT_STATE
#define BLE_ERROR_MESSAGE_INCOMPLETE CHIP_ERROR_MESSAGE_INCOMPLETE
#define BLE_ERROR_NOT_IMPLEMENTED CHIP_ERROR_NOT_IMPLEMENTED
#define BLE_ERROR_NO_ENDPOINTS CHIP_ERROR_ENDPOINT_POOL_FULL
#define BLE_ERROR_NO_MEMORY CHIP_ERROR_NO_MEMORY
#define BLE_ERROR_OUTBOUND_MESSAGE_TOO_BIG CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG
#define BLE_ERROR_RECEIVED_MESSAGE_TOO_BIG CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG

// clang-format on

namespace chip {
Expand Down
4 changes: 2 additions & 2 deletions src/inet/IPEndPointBasis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ CHIP_ERROR IPEndPointBasis::StartListener()
case nw_listener_state_cancelled:
ChipLogDetail(Inet, "Listener: Cancelled");
if (res == CHIP_NO_ERROR)
res = INET_ERROR_CONNECTION_ABORTED;
res = CHIP_ERROR_CONNECTION_ABORTED;

dispatch_semaphore_signal(mListenerSemaphore);
break;
Expand Down Expand Up @@ -1480,7 +1480,7 @@ CHIP_ERROR IPEndPointBasis::StartConnection(nw_connection_t & aConnection)
case nw_connection_state_cancelled:
ChipLogDetail(Inet, "Connection: Cancelled");
if (res == CHIP_NO_ERROR)
res = INET_ERROR_CONNECTION_ABORTED;
res = CHIP_ERROR_CONNECTION_ABORTED;

dispatch_semaphore_signal(mConnectionSemaphore);
break;
Expand Down
16 changes: 0 additions & 16 deletions src/inet/InetError.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,6 @@
* @}
*/

// !!!!! IMPORTANT !!!!!
// These definitions are present temporarily in order to reduce breakage for PRs in flight.
// TODO: remove compatibility definitions
#define INET_ERROR CHIP_ERROR
#define INET_NO_ERROR CHIP_NO_ERROR
#define INET_ERROR_BAD_ARGS CHIP_ERROR_INVALID_ARGUMENT
#define INET_ERROR_INBOUND_MESSAGE_TOO_BIG CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG
#define INET_ERROR_INCORRECT_STATE CHIP_ERROR_INCORRECT_STATE
#define INET_ERROR_MESSAGE_TOO_LONG CHIP_ERROR_MESSAGE_TOO_LONG
#define INET_ERROR_NO_CONNECTION_HANDLER CHIP_ERROR_NO_CONNECTION_HANDLER
#define INET_ERROR_NO_ENDPOINTS CHIP_ERROR_ENDPOINT_POOL_FULL
#define INET_ERROR_NOT_IMPLEMENTED CHIP_ERROR_NOT_IMPLEMENTED
#define INET_ERROR_NOT_SUPPORTED CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE
#define INET_ERROR_NO_MEMORY CHIP_ERROR_NO_MEMORY
#define INET_ERROR_CONNECTION_ABORTED CHIP_ERROR_CONNECTION_ABORTED

// clang-format on

namespace chip {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/asn1/ASN1Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ namespace ASN1 {
* @}
*/

// !!!!! IMPORTANT !!!!!
// These definitions are present temporarily in order to reduce breakage for PRs in flight.
// TODO: remove compatibility definitions
#define ASN1_ERROR CHIP_ERROR
#define ASN1_NO_ERROR CHIP_NO_ERROR

// clang-format on

bool FormatASN1Error(char * buf, uint16_t bufSize, int32_t err);
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/tests/TestReliableMessageProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void CheckDuplicateMessage(nlTestSuite * inSuite, void * inContext)

// 1 tick is 64 ms, sleep 65 ms to trigger first re-transmit
test_os_sleep_ms(65);
ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), rm, CHIP_SYSTEM_NO_ERROR);
ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), rm, CHIP_NO_ERROR);

// Ensure the retransmit message was sent and the ack was sent
// and retransmit table was cleared
Expand Down
6 changes: 0 additions & 6 deletions src/platform/mbed/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
// Show BLE status with LEDs
#define _BLEMGRIMPL_USE_LEDS 0

/* Undefine the BLE_ERROR_NOT_IMPLEMENTED macro provided by CHIP's
* src/ble/BleError.h to avoid a name conflict with Mbed-OS ble_error_t
* enum value. For the enum values, see:
* mbed-os/connectivity/FEATURE_BLE/include/ble/common/blecommon.h
*/
#undef BLE_ERROR_NOT_IMPLEMENTED
// mbed-os headers
#include "ble/BLE.h"
#include "ble/Gap.h"
Expand Down
22 changes: 11 additions & 11 deletions src/platform/mbed/SystemTimeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,45 +60,45 @@ uint64_t GetClock_MonotonicHiRes()

// Platform-specific function for getting the current real (civil) time in microsecond Unix time format,
// where |curTime| argument is the current time, expressed as Unix time scaled to microseconds.
// Returns CHIP_SYSTEM_NO_ERROR if the method succeeded.
// Returns CHIP_NO_ERROR if the method succeeded.
Error GetClock_RealTime(uint64_t & curTime)
{
struct timeval tv;
int res = gettimeofday(&tv, NULL);
if (res != 0)
{
return CHIP_SYSTEM_ERROR_UNEXPECTED_STATE;
return CHIP_ERROR_INCORRECT_STATE;
}
if (tv.tv_sec < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD)
{
return CHIP_SYSTEM_ERROR_REAL_TIME_NOT_SYNCED;
return CHIP_ERROR_REAL_TIME_NOT_SYNCED;
}
curTime = (tv.tv_sec * UINT64_C(1000000)) + tv.tv_usec;
return CHIP_SYSTEM_NO_ERROR;
return CHIP_NO_ERROR;
}

// Platform-specific function for getting the current real (civil) time in millisecond Unix time
// where |curTimeMS| is the current time, expressed as Unix time scaled to milliseconds.
// Returns CHIP_SYSTEM_NO_ERROR if the method succeeded.
// Returns CHIP_NO_ERROR if the method succeeded.
Error GetClock_RealTimeMS(uint64_t & curTimeMS)
{
struct timeval tv;
int res = gettimeofday(&tv, NULL);
if (res != 0)
{
return CHIP_SYSTEM_ERROR_UNEXPECTED_STATE;
return CHIP_ERROR_INCORRECT_STATE;
}
if (tv.tv_sec < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD)
{
return CHIP_SYSTEM_ERROR_REAL_TIME_NOT_SYNCED;
return CHIP_ERROR_REAL_TIME_NOT_SYNCED;
}
curTimeMS = (tv.tv_sec * UINT64_C(1000)) + (tv.tv_usec / 1000);
return CHIP_SYSTEM_NO_ERROR;
return CHIP_NO_ERROR;
}

// Platform-specific function for setting the current real (civil) time
// where |newCurTime| is the new current time, expressed as Unix time scaled to microseconds.
// Returns CHIP_SYSTEM_NO_ERROR if the method succeeded.
// Returns CHIP_NO_ERROR if the method succeeded.
Error SetClock_RealTime(uint64_t newCurTime)
{
struct timeval tv;
Expand All @@ -107,7 +107,7 @@ Error SetClock_RealTime(uint64_t newCurTime)
int res = settimeofday(&tv, NULL);
if (res != 0)
{
return CHIP_SYSTEM_ERROR_UNEXPECTED_STATE;
return CHIP_ERROR_INCORRECT_STATE;
}
#if CHIP_PROGRESS_LOGGING
{
Expand All @@ -120,7 +120,7 @@ Error SetClock_RealTime(uint64_t newCurTime)
tv.tv_sec, year, month, dayOfMonth, hour, minute, second);
}
#endif // CHIP_PROGRESS_LOGGING
return CHIP_SYSTEM_NO_ERROR;
return CHIP_NO_ERROR;
}

} // namespace Layer
Expand Down
15 changes: 0 additions & 15 deletions src/system/SystemError.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ extern bool FormatLwIPError(char * buf, uint16_t bufSize, CHIP_ERROR err);

// clang-format off

// !!!!! IMPORTANT !!!!!
// These definitions are present temporarily in order to reduce breakage for PRs in flight.
// TODO: remove compatibility definitions
using Error = CHIP_ERROR;
#define CHIP_SYSTEM_NO_ERROR CHIP_NO_ERROR
#define CHIP_SYSTEM_ERROR_ACCESS_DENIED CHIP_ERROR_ACCESS_DENIED
#define CHIP_SYSTEM_ERROR_BAD_ARGS CHIP_ERROR_INVALID_ARGUMENT
#define CHIP_SYSTEM_ERROR_NOT_SUPPORTED CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE
#define CHIP_SYSTEM_ERROR_NO_MEMORY CHIP_ERROR_NO_MEMORY
#define CHIP_SYSTEM_ERROR_REAL_TIME_NOT_SYNCED CHIP_ERROR_REAL_TIME_NOT_SYNCED
#define CHIP_SYSTEM_ERROR_UNEXPECTED_EVENT CHIP_ERROR_UNEXPECTED_EVENT
#define CHIP_SYSTEM_ERROR_UNEXPECTED_STATE CHIP_ERROR_INCORRECT_STATE

// clang-format on

} // namespace System
} // namespace chip

Expand Down
2 changes: 1 addition & 1 deletion src/system/SystemMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ inline Error Mutex::Init(Mutex & aMutex)
{
// The mutex is initialized when constructed and generates
// a runtime error in case of failure.
return CHIP_SYSTEM_NO_ERROR;
return CHIP_NO_ERROR;
}

inline void Mutex::Lock()
Expand Down