diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-11-03 12:25:00 -0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-11-12 08:14:37 -0800 |
| commit | 3728fc0aeb98a8fe772d6b53b626b004caddb393 (patch) | |
| tree | f428e0a980d07d506a22561c75cf12b8d25fa9cc | |
| parent | 176c6d27e3e84f884df42cff6813cc5ca77f91c8 (diff) | |
| download | meson-3728fc0aeb98a8fe772d6b53b626b004caddb393.tar.gz | |
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',
)
```
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 | ||||
| -rw-r--r-- | mesonbuild/interpreter/type_checking.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 90c61a26b..603a512b2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -3380,10 +3380,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) pch = target.pch[lang] if not pch: continue - if not has_path_sep(pch[0]) or (pch[1] and has_path_sep(pch[1])): - msg = f'Precompiled header of {target.get_basename()!r} must not be in the same ' \ - 'directory as source, please put it in a subdirectory.' - raise InvalidArguments(msg) compiler: Compiler = target.compilers[lang] if compiler.get_argument_syntax() == 'msvc': (commands, dep, dst, objs, src) = self.generate_msvc_pch_command(target, compiler, pch) diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 6cd43b7c6..b4799f3a7 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -671,6 +671,10 @@ def _pch_validator(args: T.List[str]) -> T.Optional[str]: return 'PCH files must be stored in the same folder.' elif num_args > 2: return 'A maximum of two elements are allowed for PCH arguments' + if num_args >= 1 and not has_path_sep(args[0]): + return f'PCH header {args[0]} must not be in the same directory as source files' + if num_args == 2 and not has_path_sep(args[1]): + return f'PCH source {args[0]} must not be in the same directory as source files' return None |
