diff --git a/cmd/v/help/build-c.txt b/cmd/v/help/build-c.txt index ad9553e7f2..f495c451c3 100644 --- a/cmd/v/help/build-c.txt +++ b/cmd/v/help/build-c.txt @@ -97,7 +97,7 @@ see also `v help build`. systems also (although we do not test it as regularly as for the above): `android`, `ios`, `freebsd`, `openbsd`, `netbsd`, `dragonfly`, - `solaris`, `serenity`, `haiku` + `solaris`, `serenity`, `haiku`, `vinix` Note that V has the concept of platform files, i.e. files ending with `_platform.c.v`, and usually only the matching files are used in diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 3a5a8cef22..955abdc8ed 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -21,7 +21,7 @@ const int_max = int(0x7FFFFFFF) const ( valid_comp_if_os = ['windows', 'ios', 'macos', 'mach', 'darwin', 'hpux', 'gnu', 'qnx', 'linux', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'dragonfly', 'android', 'solaris', - 'haiku', 'serenity'] + 'haiku', 'serenity', 'vinix'] valid_comp_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus'] valid_comp_if_platforms = ['amd64', 'i386', 'aarch64', 'arm64', 'arm32', 'rv64', 'rv32'] valid_comp_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian'] diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index 34c1fc47b1..2fed60304b 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -41,6 +41,7 @@ pub enum Platform { android solaris serenity + vinix haiku raw cross // TODO: add functionality for v doc -os cross whenever possible @@ -61,6 +62,7 @@ pub fn platform_from_string(platform_str string) ?Platform { 'js' { return .js } 'solaris' { return .solaris } 'serenity' { return .serenity } + 'vinix' { return .vinix } 'android' { return .android } 'haiku' { return .haiku } 'nix' { return .linux } diff --git a/vlib/v/gen/c/cheaders.v b/vlib/v/gen/c/cheaders.v index 2bc06edd87..cd4fa7928a 100644 --- a/vlib/v/gen/c/cheaders.v +++ b/vlib/v/gen/c/cheaders.v @@ -332,22 +332,7 @@ voidptr memdup(voidptr src, int sz); #error Cygwin is not supported, please use MinGW or Visual Studio. #endif -#ifdef __linux__ - #include - #include // os__wait uses wait on nix -#endif - -#ifdef __FreeBSD__ - #include - #include // os__wait uses wait on nix -#endif - -#ifdef __DragonFly__ - #include - #include // os__wait uses wait on nix -#endif - -#ifdef __serenity__ +#ifdef defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun) #include #include // os__wait uses wait on nix #endif @@ -362,11 +347,6 @@ voidptr memdup(voidptr src, int sz); #include // os__wait uses wait on nix #endif -#ifdef __sun - #include - #include // os__wait uses wait on nix -#endif - #ifdef _WIN32 #define WINVER 0x0600 #ifdef _WIN32_WINNT diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 1a45401bd2..d229af3daa 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -566,6 +566,9 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) ?string 'serenity' { return '__serenity__' } + 'vinix' { + return '__vinix__' + } 'freebsd' { return '__FreeBSD__' } diff --git a/vlib/v/pref/os.v b/vlib/v/pref/os.v index ae9874f5f3..929db54e5a 100644 --- a/vlib/v/pref/os.v +++ b/vlib/v/pref/os.v @@ -17,6 +17,7 @@ pub enum OS { android solaris serenity + vinix haiku raw all @@ -36,6 +37,7 @@ pub fn os_from_string(os_str string) ?OS { 'js' { return .js } 'solaris' { return .solaris } 'serenity' { return .serenity } + 'vinix' { return .vinix } 'android' { return .android } 'haiku' { return .haiku } 'raw' { return .raw } @@ -60,6 +62,7 @@ pub fn (o OS) str() string { .android { return 'Android' } .solaris { return 'Solaris' } .serenity { return 'SerenityOS' } + .vinix { return 'Vinix' } .haiku { return 'Haiku' } .raw { return 'Raw' } .all { return 'all' } @@ -94,6 +97,10 @@ pub fn get_host_os() OS { $if serenity { return .serenity } + // TODO: uncomment the vinix block after v.c is regenerated + // $if vinix { + // return .vinix + // } $if solaris { return .solaris } diff --git a/vlib/v/pref/should_compile.v b/vlib/v/pref/should_compile.v index d5ba148994..37a9ccdba0 100644 --- a/vlib/v/pref/should_compile.v +++ b/vlib/v/pref/should_compile.v @@ -184,6 +184,9 @@ pub fn (prefs &Preferences) should_compile_c(file string) bool { if prefs.os != .serenity && file.ends_with('_serenity.c.v') { return false } + if prefs.os != .vinix && file.ends_with('_vinix.c.v') { + return false + } return true }