fixed sizeof()
This commit is contained in:
		
							parent
							
								
									a5f05e8ba0
								
							
						
					
					
						commit
						8790a879c9
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -16,6 +16,7 @@ | ||||||
| #include	"expr.h" | #include	"expr.h" | ||||||
| #include	"idf.h" | #include	"idf.h" | ||||||
| #include	"def.h" | #include	"def.h" | ||||||
|  | #include	"sizes.h" | ||||||
| 
 | 
 | ||||||
| extern char options[]; | extern char options[]; | ||||||
| extern arith full_mask[/*MAXSIZE*/];	/* cstoper.c */ | extern arith full_mask[/*MAXSIZE*/];	/* cstoper.c */ | ||||||
|  | @ -150,7 +151,7 @@ ch3mon(oper, expp) | ||||||
| 				   (arith)((*expp)->SG_LEN) : | 				   (arith)((*expp)->SG_LEN) : | ||||||
| 				   size_of_type((*expp)->ex_type, | 				   size_of_type((*expp)->ex_type, | ||||||
| 				       symbol2str((*expp)->ex_type->tp_fund)) | 				       symbol2str((*expp)->ex_type->tp_fund)) | ||||||
| 			       , ULONG); | 			       , (int_size == pointer_size ? UNSIGNED : ULONG)); | ||||||
| 		expr->ex_flags |= EX_SIZEOF; | 		expr->ex_flags |= EX_SIZEOF; | ||||||
| 		free_expression(*expp); | 		free_expression(*expp); | ||||||
| 		*expp = expr; | 		*expp = expr; | ||||||
|  |  | ||||||
|  | @ -16,6 +16,7 @@ | ||||||
| #include	"label.h" | #include	"label.h" | ||||||
| #include	"expr.h" | #include	"expr.h" | ||||||
| #include	"code.h" | #include	"code.h" | ||||||
|  | #include	"sizes.h" | ||||||
| 
 | 
 | ||||||
| extern struct expr *intexpr(); | extern struct expr *intexpr(); | ||||||
| int InSizeof = 0;	/* inside a sizeof- expression */ | int InSizeof = 0;	/* inside a sizeof- expression */ | ||||||
|  | @ -146,7 +147,8 @@ size_of(register struct expr **expp;) | ||||||
| 	[%if (first_of_type_specifier(AHEAD) && AHEAD != IDENTIFIER) | 	[%if (first_of_type_specifier(AHEAD) && AHEAD != IDENTIFIER) | ||||||
| 		cast(&tp) | 		cast(&tp) | ||||||
| 		{ | 		{ | ||||||
| 			*expp = intexpr(size_of_type(tp, "type"), ULONG); | 			*expp = intexpr(size_of_type(tp, "type"), | ||||||
|  | 				(int_size == pointer_size ? UNSIGNED : ULONG)); | ||||||
| 			(*expp)->ex_flags |= EX_SIZEOF; | 			(*expp)->ex_flags |= EX_SIZEOF; | ||||||
| 		} | 		} | ||||||
| 	| | 	| | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue