aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/depscan.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-07-25 16:46:45 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-07-25 16:59:41 -0400
commit5b2f921d524657605daf0ddedc4d6088c5726056 (patch)
tree5e55b0401f672c278b9076acd8a839593a057511 /mesonbuild/scripts/depscan.py
parentec388fe7c2b93879499ad782c2da41ec22d003b2 (diff)
downloadmeson-5b2f921d524657605daf0ddedc4d6088c5726056.zip
meson-5b2f921d524657605daf0ddedc4d6088c5726056.tar.gz
meson-5b2f921d524657605daf0ddedc4d6088c5726056.tar.bz2
ninja depscanner: handle C++ sources named capital C
In commit 4ca9a16288f51cce99624a2ef595d879acdc02d8 we added unreliable support (it warns you if you try it) for gcc-compatible treatment of uppercase-C files being C++ instead of C. In order to handle it correctly, we needed to evaluate can-compile by special-casing "C" to avoid lowercasing it for comparisons. This didn't cover all cases where we check if "C" is a C++ language file. We also straight-up check the language of a file (rather than working backwards to see if a C++ compiler can compile it) when doing module scanning, and this needs to special-case "C" as well. We also had one case where we only checked lowercase fortran extensions, but not lowercase C++ extensions. While we are at it, use lowercase for C++ as well, except the "C" special case. Fixes #10629
Diffstat (limited to 'mesonbuild/scripts/depscan.py')
-rw-r--r--mesonbuild/scripts/depscan.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py
index 5fa30cb..3ae14c0 100644
--- a/mesonbuild/scripts/depscan.py
+++ b/mesonbuild/scripts/depscan.py
@@ -51,7 +51,9 @@ class DependencyScanner:
self.sources_with_exports: T.List[str] = []
def scan_file(self, fname: str) -> None:
- suffix = os.path.splitext(fname)[1][1:].lower()
+ suffix = os.path.splitext(fname)[1][1:]
+ if suffix != 'C':
+ suffix = suffix.lower()
if suffix in lang_suffixes['fortran']:
self.scan_fortran_file(fname)
elif suffix in lang_suffixes['cpp']: