mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:07:35 +00:00
AK: Ignore -Wshadow in TRY() and MUST()
This makes the warning in CLion disappear when nesting them.
This commit is contained in:
parent
d2e143eec7
commit
5103e08b77
1 changed files with 17 additions and 11 deletions
10
AK/Try.h
10
AK/Try.h
|
@ -6,6 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Diagnostics.h>
|
||||
|
||||
// NOTE: This macro works with any result type that has the expected APIs.
|
||||
// It's designed with AK::Result and AK::Error in mind.
|
||||
//
|
||||
|
@ -16,7 +18,9 @@
|
|||
|
||||
#define TRY(expression) \
|
||||
({ \
|
||||
auto _temporary_result = (expression); \
|
||||
/* Ignore -Wshadow to allow nesting the macro. */ \
|
||||
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
|
||||
auto _temporary_result = (expression)); \
|
||||
if (_temporary_result.is_error()) [[unlikely]] \
|
||||
return _temporary_result.release_error(); \
|
||||
_temporary_result.release_value(); \
|
||||
|
@ -24,7 +28,9 @@
|
|||
|
||||
#define MUST(expression) \
|
||||
({ \
|
||||
auto _temporary_result = (expression); \
|
||||
/* Ignore -Wshadow to allow nesting the macro. */ \
|
||||
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
|
||||
auto _temporary_result = (expression)); \
|
||||
VERIFY(!_temporary_result.is_error()); \
|
||||
_temporary_result.release_value(); \
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue