v.checker: deprecate `$if linux_or_macos {` in favor of `$if linux || macos {`
							parent
							
								
									cbf30bd13a
								
							
						
					
					
						commit
						c16d4911c2
					
				| 
						 | 
				
			
			@ -3787,7 +3787,7 @@ Full list of builtin options:
 | 
			
		|||
| `mac`, `darwin`, `ios`,       | `clang`, `mingw`  | `x64`, `x32`          | `js`, `glibc`, `prealloc` |
 | 
			
		||||
| `android`,`mach`, `dragonfly` | `msvc`            | `little_endian`       | `no_bounds_checking`, `freestanding`    |
 | 
			
		||||
| `gnu`, `hpux`, `haiku`, `qnx` | `cplusplus`       | `big_endian`          |
 | 
			
		||||
| `solaris`, `linux_or_macos`   | | | |
 | 
			
		||||
| `solaris` | | | |
 | 
			
		||||
 | 
			
		||||
#### $embed_file
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,8 @@ 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', 'linux_or_macos']
 | 
			
		||||
		'haiku',
 | 
			
		||||
	]
 | 
			
		||||
	valid_comp_if_compilers     = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus']
 | 
			
		||||
	valid_comp_if_platforms     = ['amd64', 'aarch64', 'arm64', 'x64', 'x32', 'little_endian',
 | 
			
		||||
		'big_endian',
 | 
			
		||||
| 
						 | 
				
			
			@ -6024,6 +6025,11 @@ fn (mut c Checker) comp_if_branch(cond ast.Expr, pos token.Position) bool {
 | 
			
		|||
					else { return false }
 | 
			
		||||
				}
 | 
			
		||||
			} else if cond.name !in c.pref.compile_defines_all {
 | 
			
		||||
				if cond.name == 'linux_or_macos' {
 | 
			
		||||
					c.error('linux_or_macos is deprecated, please use `\$if linux || macos {` instead',
 | 
			
		||||
						cond.pos)
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
				// `$if some_var {}`
 | 
			
		||||
				typ := c.expr(cond)
 | 
			
		||||
				if cond.obj !is ast.Var && cond.obj !is ast.ConstField
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ pub fn platform_from_string(platform_str string) ?Platform {
 | 
			
		|||
		'solaris' { return .solaris }
 | 
			
		||||
		'android' { return .android }
 | 
			
		||||
		'haiku' { return .haiku }
 | 
			
		||||
		'linux_or_macos', 'nix' { return .linux }
 | 
			
		||||
		'nix' { return .linux }
 | 
			
		||||
		'' { return .auto }
 | 
			
		||||
		else { return error('vdoc: invalid platform `$platform_str`') }
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,9 +9,9 @@ const (
 | 
			
		|||
	// Euler's constant
 | 
			
		||||
	eulers              = 2.7182
 | 
			
		||||
	supported_platforms = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly',
 | 
			
		||||
		'android', 'js', 'solaris', 'haiku', 'linux_or_macos']
 | 
			
		||||
		'android', 'js', 'solaris', 'haiku']
 | 
			
		||||
	one_line_supported  = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly',
 | 
			
		||||
		'android', 'js', 'solaris', 'haiku', 'linux_or_macos']
 | 
			
		||||
		'android', 'js', 'solaris', 'haiku']
 | 
			
		||||
	another_const       = ['a', 'b', 'c', 'd', 'e', 'f']
 | 
			
		||||
	multiline_const     = [
 | 
			
		||||
		'first line',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,8 +9,8 @@ phi=1.618
 | 
			
		|||
	//Euler's constant
 | 
			
		||||
eulers=2.7182
 | 
			
		||||
supported_platforms = ['windows', 'macos', 'linux', 'freebsd', 'openbsd',
 | 
			
		||||
		'netbsd', 'dragonfly', 'android', 'js', 'solaris', 'haiku', 'linux_or_macos']
 | 
			
		||||
one_line_supported    = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'android', 'js', 'solaris', 'haiku', 'linux_or_macos']
 | 
			
		||||
		'netbsd', 'dragonfly', 'android', 'js', 'solaris', 'haiku']
 | 
			
		||||
one_line_supported    = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'android', 'js', 'solaris', 'haiku']
 | 
			
		||||
another_const = ['a', 'b'
 | 
			
		||||
		'c', 'd', 'e'
 | 
			
		||||
		'f'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -543,9 +543,6 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) ?string
 | 
			
		|||
		'haiku' {
 | 
			
		||||
			return '__haiku__'
 | 
			
		||||
		}
 | 
			
		||||
		'linux_or_macos' {
 | 
			
		||||
			return ''
 | 
			
		||||
		}
 | 
			
		||||
		//
 | 
			
		||||
		'js' {
 | 
			
		||||
			return '_VJS'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ pub fn os_from_string(os_str string) ?OS {
 | 
			
		|||
		'android' { return .android }
 | 
			
		||||
		'haiku' { return .haiku }
 | 
			
		||||
		'raw' { return .raw }
 | 
			
		||||
		'linux_or_macos', 'nix' { return .linux }
 | 
			
		||||
		'nix' { return .linux }
 | 
			
		||||
		'' { return ._auto }
 | 
			
		||||
		else { return error('bad OS $os_str') }
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue