v.gen.c: fix `v examples/hello_world.v` on FreeBSD

pull/12012/head
Delyan Angelov 2021-09-28 12:00:34 +03:00
parent 8f4fe61381
commit d07a96ede8
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 2 additions and 1 deletions

View File

@ -5879,7 +5879,8 @@ fn (mut g Gen) write_init_function() {
// ___argv is declared as voidptr here, because that unifies the windows/unix logic // ___argv is declared as voidptr here, because that unifies the windows/unix logic
g.writeln('void _vinit(int ___argc, voidptr ___argv) {') g.writeln('void _vinit(int ___argc, voidptr ___argv) {')
g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(SIGSEGV, v_segmentation_fault_handler);\n#endif') // 11 is SIGSEGV. It is hardcoded here, to avoid FreeBSD compilation errors for trivial examples.
g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(11, v_segmentation_fault_handler);\n#endif')
if g.pref.prealloc { if g.pref.prealloc {
g.writeln('prealloc_vinit();') g.writeln('prealloc_vinit();')
} }