mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Use (and ignore) the expression provided to log_assert in NDEBUG builds.
This avoids warnings in NDEBUG builds emitted when a variable is only used in log_assert, but is always defined.
This commit is contained in:
		
							parent
							
								
									d5d0cc88d2
								
							
						
					
					
						commit
						2ffdb74fb1
					
				
					 3 changed files with 1 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -362,9 +362,7 @@ void ILANG_BACKEND::dump_module(std::ostream &f, std::string indent, RTLIL::Modu
 | 
			
		|||
 | 
			
		||||
void ILANG_BACKEND::dump_design(std::ostream &f, RTLIL::Design *design, bool only_selected, bool flag_m, bool flag_n)
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
	int init_autoidx = autoidx;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!flag_m) {
 | 
			
		||||
		int count_selected_mods = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ static inline void log_assert_worker(bool cond, const char *expr, const char *fi
 | 
			
		|||
}
 | 
			
		||||
#  define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
 | 
			
		||||
#else
 | 
			
		||||
#  define log_assert(_assert_expr_)
 | 
			
		||||
#  define log_assert(_assert_expr_) do { if (0) { (void)(_assert_expr_); } } while(0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define log_abort() YOSYS_NAMESPACE_PREFIX log_error("Abort in %s:%d.\n", __FILE__, __LINE__)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,10 +107,8 @@ struct Macc
 | 
			
		|||
		std::vector<RTLIL::State> config_bits = cell->getParam(ID::CONFIG).bits;
 | 
			
		||||
		int config_cursor = 0;
 | 
			
		||||
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
		int config_width = cell->getParam(ID::CONFIG_WIDTH).as_int();
 | 
			
		||||
		log_assert(GetSize(config_bits) >= config_width);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		int num_bits = 0;
 | 
			
		||||
		if (config_bits[config_cursor++] == State::S1) num_bits |= 1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue