Annotate intentional handler fallthrough
Co-authored-by: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
@@ -391,6 +391,18 @@ akerr_ErrorContext AKERR_NOIGNORE *__akerr_copy_string(char *destination, int ca
|
||||
* Defines for the ATTEMPT/CATCH/CLEANUP/PROCESS/HANDLE/FINISH process
|
||||
*/
|
||||
|
||||
/*
|
||||
* HANDLE_GROUP deliberately enters the next case label. GCC and clang both
|
||||
* understand this spelling in the C modes supported by libakerror. Other
|
||||
* compilers keep the established control flow without receiving an attribute
|
||||
* they do not implement.
|
||||
*/
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define AKERR_FALLTHROUGH __attribute__((fallthrough));
|
||||
#else
|
||||
#define AKERR_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#define ATTEMPT \
|
||||
switch ( 0 ) { \
|
||||
case 0: \
|
||||
@@ -443,6 +455,7 @@ akerr_ErrorContext AKERR_NOIGNORE *__akerr_copy_string(char *destination, int ca
|
||||
__err_context->handled = true;
|
||||
|
||||
#define HANDLE_GROUP(__err_context, __err_status) \
|
||||
AKERR_FALLTHROUGH \
|
||||
case __err_status: \
|
||||
__err_context->stacktracebufptr = (char *)&__err_context->stacktracebuf; \
|
||||
__err_context->handled = true;
|
||||
|
||||
Reference in New Issue
Block a user