Error check fragment rules which don't emit anything.
This commit is contained in:
		
							parent
							
								
									0d246c0d73
								
							
						
					
					
						commit
						b27758b7de
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -1014,6 +1014,15 @@ static void emitinsndata(Rule rules) | ||||||
| 
 | 
 | ||||||
| 			print("}\n\n"); | 			print("}\n\n"); | ||||||
| 		} | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			/* This instruction has no code; make sure it's not a fragment. */ | ||||||
|  | 			if (r->lhs->is_fragment) | ||||||
|  | 			{ | ||||||
|  | 				yylineno = r->lineno; | ||||||
|  | 				yyerror("rule is a fragment, but doesn't emit anything"); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		r = r->link; | 		r = r->link; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue