From 151cd0bfe69b44ef36892272651f34d4dbebd858 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 9 Jul 2021 02:26:43 +0200 Subject: [PATCH] all: SerenityOS support (#10702) --- vlib/v/gen/c/comptime.v | 3 +++ vlib/v/pref/os.v | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 89fb027382..ccfc8d8f72 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -559,6 +559,9 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) ?string 'linux' { return '__linux__' } + 'serenity' { + return '__serenity__' + } 'freebsd' { return '__FreeBSD__' } diff --git a/vlib/v/pref/os.v b/vlib/v/pref/os.v index 3bb6e3a3a6..15e0ac2db4 100644 --- a/vlib/v/pref/os.v +++ b/vlib/v/pref/os.v @@ -16,6 +16,7 @@ pub enum OS { js // TODO android solaris + serenity haiku raw all @@ -34,6 +35,7 @@ pub fn os_from_string(os_str string) ?OS { 'dragonfly' { return .dragonfly } 'js' { return .js } 'solaris' { return .solaris } + 'serenity' { return .serenity } 'android' { return .android } 'haiku' { return .haiku } 'raw' { return .raw } @@ -57,6 +59,7 @@ pub fn (o OS) str() string { .js { return 'JavaScript' } .android { return 'Android' } .solaris { return 'Solaris' } + .serenity { return 'serenity' } .haiku { return 'Haiku' } .raw { return 'Raw' } .all { return 'all' } @@ -88,6 +91,13 @@ pub fn get_host_os() OS { $if dragonfly { return .dragonfly } + /* + // TODO: uncomment after regenerating vc.c + $if serenity { + return .serenity + } + */ + $if solaris { return .solaris }