From ebbaeec51b5c5c8177fe6583a2a5bd6b7f929684 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sun, 23 Oct 2022 11:28:42 +0200 Subject: gnulike: Fix preprocessing files with any extension --- mesonbuild/compilers/mixins/gnu.py | 6 ++++++ test cases/common/255 preprocess/src/meson.build | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 11efcc9fe..eb1c534e6 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -318,6 +318,12 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta): def get_coverage_args(self) -> T.List[str]: return ['--coverage'] + def get_preprocess_to_file_args(self) -> T.List[str]: + # We want to allow preprocessing files with any extension, such as + # foo.c.in. In that case we need to tell GCC/CLANG to treat them as + # assembly file. + return self.get_preprocess_only_args() + ['-x', 'assembler-with-cpp'] + class GnuCompiler(GnuLikeCompiler): """ diff --git a/test cases/common/255 preprocess/src/meson.build b/test cases/common/255 preprocess/src/meson.build index 3169bb5ca..4cd955444 100644 --- a/test cases/common/255 preprocess/src/meson.build +++ b/test cases/common/255 preprocess/src/meson.build @@ -1,4 +1,3 @@ file_map = cc.preprocess('file.map.in', output: '@BASENAME@', - compile_args: ['-x', 'assembler-with-cpp'], ) -- cgit v1.2.3