diff options
author | marxin <mliska@suse.cz> | 2019-02-20 21:59:03 +0100 |
---|---|---|
committer | marxin <mliska@suse.cz> | 2019-02-21 19:34:35 +0100 |
commit | 7de7f0ef178d2800f1ca70c15e8aff8aeb16bb8d (patch) | |
tree | e4d933f2c7ea2259b2821b2601aba224d38184f6 /core/error_macros.h | |
parent | a01dca79e2f7b7cb221a4c416cade4fad2941446 (diff) | |
download | redot-engine-7de7f0ef178d2800f1ca70c15e8aff8aeb16bb8d.tar.gz |
Fix all -Wtype-limits warnings.
Diffstat (limited to 'core/error_macros.h')
-rw-r--r-- | core/error_macros.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/error_macros.h b/core/error_macros.h index 60a0e8a7dc..3aa8ed4596 100644 --- a/core/error_macros.h +++ b/core/error_macros.h @@ -154,6 +154,20 @@ extern bool _err_error_exists; _err_error_exists = false; \ } while (0); // (*) +/** An index has failed if m_index >=m_size, the function exists. +* This function returns an error value, if returning Error, please select the most +* appropriate error condition from error_macros.h +*/ + +#define ERR_FAIL_UNSIGNED_INDEX_V(m_index, m_size, m_retval) \ + do { \ + if (unlikely((m_index) >= (m_size))) { \ + _err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \ + return m_retval; \ + } else \ + _err_error_exists = false; \ + } while (0); // (*) + /** Use this one if there is no sensible fallback, that is, the error is unrecoverable. * We'll return a null reference and try to keep running. */ |