mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 19:52:31 +00:00 
			
		
		
		
	Added #ifdef NDEBUG for log_assert()
This commit is contained in:
		
							parent
							
								
									909a95182b
								
							
						
					
					
						commit
						8fe9ab50e5
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -79,12 +79,16 @@ template<typename T> static inline const char *log_id(T *obj) { | |||
| 
 | ||||
| void log_cell(RTLIL::Cell *cell, std::string indent = ""); | ||||
| 
 | ||||
| #ifndef NDEBUG | ||||
| static inline void log_assert_worker(bool cond, const char *expr, const char *file, int line) { | ||||
| 	if (!cond) log_error("Assert `%s' failed in %s:%d.\n", expr, file, line); | ||||
| } | ||||
| #  define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__) | ||||
| #else | ||||
| #  define log_assert(_assert_expr_) | ||||
| #endif | ||||
| 
 | ||||
| #define log_abort() YOSYS_NAMESPACE_PREFIX log_error("Abort in %s:%d.\n", __FILE__, __LINE__) | ||||
| #define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__) | ||||
| #define log_ping() YOSYS_NAMESPACE_PREFIX log("-- %s:%d %s --\n", __FILE__, __LINE__, __PRETTY_FUNCTION__) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue