builder: pass `-std=gnu99` to the C backend under linux (#12236)
parent
3e52d54586
commit
7c1fff3495
|
@ -243,7 +243,7 @@ see also `v help build`.
|
|||
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
|
||||
By default, V passes -std=gnu99(linux)/-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 ''
|
||||
|
|
|
@ -162,8 +162,12 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
|
|||
// arguments for the C compiler
|
||||
ccoptions.args = [v.pref.cflags]
|
||||
if !v.pref.no_std {
|
||||
if v.pref.os == .linux {
|
||||
ccoptions.args << '-std=gnu99 -D_DEFAULT_SOURCE'
|
||||
} else {
|
||||
ccoptions.args << '-std=c99 -D_DEFAULT_SOURCE'
|
||||
}
|
||||
}
|
||||
ccoptions.wargs = [
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
|
|
|
@ -176,7 +176,7 @@ pub mut:
|
|||
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
|
||||
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
|
||||
no_std bool // when true, do not pass -std=gnu99(linux)/-std=c99 to the C backend
|
||||
use_color ColorOutput // whether the warnings/errors should use ANSI color escapes.
|
||||
no_parallel bool
|
||||
is_vweb bool // skip _ var warning in templates
|
||||
|
|
Loading…
Reference in New Issue