v.pref, v.builder: support `-no-std` (skips passing `-std=c99` to the C backend)
							parent
							
								
									b1186cca3f
								
							
						
					
					
						commit
						eef7eea7bc
					
				|  | @ -237,6 +237,13 @@ see also `v help build`. | ||||||
|       you use -no-rsp, V will pass the C compiler options directly to the C |       you use -no-rsp, V will pass the C compiler options directly to the C | ||||||
|       compiler, on the command line, without writing an .rsp file first. |       compiler, on the command line, without writing an .rsp file first. | ||||||
| 
 | 
 | ||||||
|  |    -no-std | ||||||
|  |       By default, V passes -std=c99 to the C backend, but some compilers do | ||||||
|  |       not support that, even though they may be able to compile the produced | ||||||
|  |       code, or have other options that can be tuned to allow it. | ||||||
|  |       Passing -no-std will remove that flag, and you can then use -cflags '' | ||||||
|  |       to pass the other options for your specific C compiler. | ||||||
|  | 
 | ||||||
| -assert aborts | -assert aborts | ||||||
|       Call abort() after an assertion failure. Debuggers usually |       Call abort() after an assertion failure. Debuggers usually | ||||||
|       install signal handlers for SIGABRT, so your program will stop and you |       install signal handlers for SIGABRT, so your program will stop and you | ||||||
|  |  | ||||||
|  | @ -186,7 +186,10 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { | ||||||
| 	mut debug_options := ['-g'] | 	mut debug_options := ['-g'] | ||||||
| 	mut optimization_options := ['-O2'] | 	mut optimization_options := ['-O2'] | ||||||
| 	// arguments for the C compiler
 | 	// arguments for the C compiler
 | ||||||
| 	ccoptions.args = [v.pref.cflags, '-std=gnu99'] | 	ccoptions.args = [v.pref.cflags] | ||||||
|  | 	if !v.pref.no_std { | ||||||
|  | 		ccoptions.args << '-std=c99' | ||||||
|  | 	} | ||||||
| 	ccoptions.wargs = [ | 	ccoptions.wargs = [ | ||||||
| 		'-Wall', | 		'-Wall', | ||||||
| 		'-Wextra', | 		'-Wextra', | ||||||
|  |  | ||||||
|  | @ -173,6 +173,7 @@ pub mut: | ||||||
| 	fatal_errors        bool        // unconditionally exit after the first error with exit(1)
 | 	fatal_errors        bool        // unconditionally exit after the first error with exit(1)
 | ||||||
| 	reuse_tmpc          bool        // do not use random names for .tmp.c and .tmp.c.rsp files, and do not remove them
 | 	reuse_tmpc          bool        // do not use random names for .tmp.c and .tmp.c.rsp files, and do not remove them
 | ||||||
| 	no_rsp              bool        // when true, pass C backend options directly on the CLI (do not use `.rsp` files for them, some older C compilers do not support them)
 | 	no_rsp              bool        // when true, pass C backend options directly on the CLI (do not use `.rsp` files for them, some older C compilers do not support them)
 | ||||||
|  | 	no_std              bool        // when true, do not pass -std=c99 to the C backend
 | ||||||
| 	use_color           ColorOutput // whether the warnings/errors should use ANSI color escapes.
 | 	use_color           ColorOutput // whether the warnings/errors should use ANSI color escapes.
 | ||||||
| 	is_parallel         bool | 	is_parallel         bool | ||||||
| 	error_limit         int | 	error_limit         int | ||||||
|  | @ -478,6 +479,9 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences | ||||||
| 			'-no-rsp' { | 			'-no-rsp' { | ||||||
| 				res.no_rsp = true | 				res.no_rsp = true | ||||||
| 			} | 			} | ||||||
|  | 			'-no-std' { | ||||||
|  | 				res.no_std = true | ||||||
|  | 			} | ||||||
| 			'-keepc' { | 			'-keepc' { | ||||||
| 				res.reuse_tmpc = true | 				res.reuse_tmpc = true | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue