mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:32:44 +00:00 
			
		
		
		
	AK: Annotate Checked functions with [[nodiscard]]
This commit is contained in:
		
							parent
							
								
									b6726df828
								
							
						
					
					
						commit
						5165661799
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		
							
								
								
									
										10
									
								
								AK/Checked.h
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								AK/Checked.h
									
										
									
									
									
								
							|  | @ -104,7 +104,7 @@ struct TypeBoundsChecker<Destination, Source, true, true, false> { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| template<typename Destination, typename Source> | template<typename Destination, typename Source> | ||||||
| constexpr bool is_within_range(Source value) | [[nodiscard]] constexpr bool is_within_range(Source value) | ||||||
| { | { | ||||||
|     return TypeBoundsChecker<Destination, Source>::is_within_range(value); |     return TypeBoundsChecker<Destination, Source>::is_within_range(value); | ||||||
| } | } | ||||||
|  | @ -149,7 +149,7 @@ public: | ||||||
|         return *this; |         return *this; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     constexpr bool has_overflow() const |     [[nodiscard]] constexpr bool has_overflow() const | ||||||
|     { |     { | ||||||
|         return m_overflow; |         return m_overflow; | ||||||
|     } |     } | ||||||
|  | @ -265,7 +265,7 @@ public: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<typename U, typename V> |     template<typename U, typename V> | ||||||
|     static constexpr bool addition_would_overflow(U u, V v) |     [[nodiscard]] static constexpr bool addition_would_overflow(U u, V v) | ||||||
|     { |     { | ||||||
| #ifdef __clang__ | #ifdef __clang__ | ||||||
|         Checked checked; |         Checked checked; | ||||||
|  | @ -278,7 +278,7 @@ public: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<typename U, typename V> |     template<typename U, typename V> | ||||||
|     static constexpr bool multiplication_would_overflow(U u, V v) |     [[nodiscard]] static constexpr bool multiplication_would_overflow(U u, V v) | ||||||
|     { |     { | ||||||
| #ifdef __clang__ | #ifdef __clang__ | ||||||
|         Checked checked; |         Checked checked; | ||||||
|  | @ -291,7 +291,7 @@ public: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<typename U, typename V, typename X> |     template<typename U, typename V, typename X> | ||||||
|     static constexpr bool multiplication_would_overflow(U u, V v, X x) |     [[nodiscard]] static constexpr bool multiplication_would_overflow(U u, V v, X x) | ||||||
|     { |     { | ||||||
|         Checked checked; |         Checked checked; | ||||||
|         checked = u; |         checked = u; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brian Gianforcaro
						Brian Gianforcaro