mirror of
				https://github.com/netwide-assembler/nasm.git
				synced 2025-10-10 00:25:06 -04:00 
			
		
		
		
	nasm: Convert operating_mode to use bitmask
We will need it to handle mode continuations. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
		
							
								
								
									
										29
									
								
								nasm.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								nasm.c
									
									
									
									
									
								
							| @@ -128,12 +128,11 @@ static const struct forwrefinfo *forwref; | |||||||
|  |  | ||||||
| static struct preproc_ops *preproc; | static struct preproc_ops *preproc; | ||||||
|  |  | ||||||
| enum op_type { | #define OP_NORMAL           (1u << 0) | ||||||
|     OP_NORMAL,                  /* Preprocess and assemble */ | #define OP_PREPROCESS       (1u << 1) | ||||||
|     OP_PREPROCESS,              /* Preprocess only */ | #define OP_DEPEND           (1u << 2) | ||||||
|     OP_DEPEND,                  /* Generate dependencies */ |  | ||||||
| }; | static unsigned int operating_mode; | ||||||
| static enum op_type operating_mode; |  | ||||||
|  |  | ||||||
| /* Dependency flags */ | /* Dependency flags */ | ||||||
| static bool depend_emit_phony = false; | static bool depend_emit_phony = false; | ||||||
| @@ -374,9 +373,7 @@ int main(int argc, char **argv) | |||||||
|     if (!depend_target) |     if (!depend_target) | ||||||
|         depend_target = quote_for_make(outname); |         depend_target = quote_for_make(outname); | ||||||
|  |  | ||||||
|     switch (operating_mode) { |     if (operating_mode & OP_DEPEND) { | ||||||
|     case OP_DEPEND: |  | ||||||
|         { |  | ||||||
|             char *line; |             char *line; | ||||||
|  |  | ||||||
|             if (depend_missing_ok) |             if (depend_missing_ok) | ||||||
| @@ -389,11 +386,7 @@ int main(int argc, char **argv) | |||||||
|             while ((line = preproc->getline())) |             while ((line = preproc->getline())) | ||||||
|                 nasm_free(line); |                 nasm_free(line); | ||||||
|             preproc->cleanup(0); |             preproc->cleanup(0); | ||||||
|         } |     } else if (operating_mode & OP_PREPROCESS) { | ||||||
|         break; |  | ||||||
|  |  | ||||||
|     case OP_PREPROCESS: |  | ||||||
|         { |  | ||||||
|             char *line; |             char *line; | ||||||
|             char *file_name = NULL; |             char *file_name = NULL; | ||||||
|             int32_t prior_linnum = 0; |             int32_t prior_linnum = 0; | ||||||
| @@ -441,11 +434,7 @@ int main(int argc, char **argv) | |||||||
|             if (ofile && terminate_after_phase) |             if (ofile && terminate_after_phase) | ||||||
|                 remove(outname); |                 remove(outname); | ||||||
|             ofile = NULL; |             ofile = NULL; | ||||||
|         } |     } else if (operating_mode & OP_NORMAL) { | ||||||
|         break; |  | ||||||
|  |  | ||||||
|     case OP_NORMAL: |  | ||||||
|         { |  | ||||||
|             /* |             /* | ||||||
|              * We must call ofmt->filename _anyway_, even if the user |              * We must call ofmt->filename _anyway_, even if the user | ||||||
|              * has specified their own output file, because some |              * has specified their own output file, because some | ||||||
| @@ -491,8 +480,6 @@ int main(int argc, char **argv) | |||||||
|                 ofile = NULL; |                 ofile = NULL; | ||||||
|             } |             } | ||||||
|     } |     } | ||||||
|         break; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (depend_list && !terminate_after_phase) |     if (depend_list && !terminate_after_phase) | ||||||
|         emit_dependencies(depend_list); |         emit_dependencies(depend_list); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user