From 7e6d8454a4545dc26916e8db0d718d6d66369bd4 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 15 Jun 2013 02:40:53 +0300 Subject: [PATCH] Precompiled headers work for C++. --- interpreter.py | 4 +++- test cases/common/14 cpp pch/meson.build | 2 +- test cases/common/14 cpp pch/pch/prog_pch.cc | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test cases/common/14 cpp pch/pch/prog_pch.cc diff --git a/interpreter.py b/interpreter.py index da53cc2e4..36bb318d0 100755 --- a/interpreter.py +++ b/interpreter.py @@ -484,7 +484,9 @@ class BuildTarget(InterpreterObject): elif environment.is_source(pchlist[0]): if not environment.is_header(pchlist[1]): raise InterpreterException('PCH definition must contain one header and at most one source.') - pchlist = [pchlist[1], pchlist[0]] + pchlist = [pchlist[1], pchlist[0]] + else: + raise InterpreterException('PCH argument %s is of unknown type.' % pchlist[0]) elif len(pchlist) > 2: raise InterpreterException('PCH definition may have a maximum of 2 files.') self.pch[language] = pchlist diff --git a/test cases/common/14 cpp pch/meson.build b/test cases/common/14 cpp pch/meson.build index d56800b93..6922fd7b6 100644 --- a/test cases/common/14 cpp pch/meson.build +++ b/test cases/common/14 cpp pch/meson.build @@ -1,2 +1,2 @@ project('c++ pch test', 'cpp') -exe = executable('prog', 'prog.cc', pch : 'pch/prog.hh') +exe = executable('prog', 'prog.cc', cpp_pch : ['pch/prog.hh', 'pch/prog_pch.cc']) diff --git a/test cases/common/14 cpp pch/pch/prog_pch.cc b/test cases/common/14 cpp pch/pch/prog_pch.cc new file mode 100644 index 000000000..aff122589 --- /dev/null +++ b/test cases/common/14 cpp pch/pch/prog_pch.cc @@ -0,0 +1,5 @@ +#if !defined(_MSC_VER) +#error "This file is only for use with MSVC." +#endif + +#include "prog.hh"