Skip to content

Commit 3728fc0

Browse files
committed
interpreter: move backend type checking to interpreter
Of course, this checking isn't actually doing what it claims, as it doesn't actually stop you from writing at target like: ```meson build_target( 'foo', 'srcs/main.c', c_pch : 'src/pch.h', ) ```
1 parent 176c6d2 commit 3728fc0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mesonbuild/backend/ninjabackend.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,10 +3380,6 @@ def generate_pch(self, target: build.BuildTarget, header_deps=None):
33803380
pch = target.pch[lang]
33813381
if not pch:
33823382
continue
3383-
if not has_path_sep(pch[0]) or (pch[1] and has_path_sep(pch[1])):
3384-
msg = f'Precompiled header of {target.get_basename()!r} must not be in the same ' \
3385-
'directory as source, please put it in a subdirectory.'
3386-
raise InvalidArguments(msg)
33873383
compiler: Compiler = target.compilers[lang]
33883384
if compiler.get_argument_syntax() == 'msvc':
33893385
(commands, dep, dst, objs, src) = self.generate_msvc_pch_command(target, compiler, pch)

mesonbuild/interpreter/type_checking.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,10 @@ def _pch_validator(args: T.List[str]) -> T.Optional[str]:
671671
return 'PCH files must be stored in the same folder.'
672672
elif num_args > 2:
673673
return 'A maximum of two elements are allowed for PCH arguments'
674+
if num_args >= 1 and not has_path_sep(args[0]):
675+
return f'PCH header {args[0]} must not be in the same directory as source files'
676+
if num_args == 2 and not has_path_sep(args[1]):
677+
return f'PCH source {args[0]} must not be in the same directory as source files'
674678
return None
675679

676680

0 commit comments

Comments
 (0)