Git Product home page Git Product logo

Comments (4)

jpakkane avatar jpakkane commented on May 29, 2024

This is actually a bug in Clang. It has been reported upstream here:

http://llvm.org/bugs/show_bug.cgi?id=15136

from meson.

objectx avatar objectx commented on May 29, 2024

Oh!

I've created quick and dirty workaround for clang:

diff --git a/environment.py b/environment.py
index 1cf26ca..9e1a90e 100644
--- a/environment.py
+++ b/environment.py
@@ -1099,6 +1099,9 @@ class ClangCCompiler(CCompiler):
     def can_compile(self, filename):
         return super().can_compile(filename) or filename.split('.')[-1] == 's' # Clang can do asm, too.

+    def get_pch_use_args(self, pch_dir, header):
+        return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))]
+
 class GnuCPPCompiler(CPPCompiler):
     std_warn_args = ['-Wall', '-Winvalid-pch']
     # may need to separate the latter to extra_debug_args or something
@@ -1149,6 +1152,9 @@ class ClangCPPCompiler(CPPCompiler):
     def get_pch_suffix(self):
         return 'pch'

+    def get_pch_use_args(self, pch_dir, header):
+        return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))]
+
 class FortranCompiler():
     std_warn_args = ['-Wall']

from meson.

jpakkane avatar jpakkane commented on May 29, 2024

Thanks for this. Unfortunately -include-pch is not a Clang frontend flag bug a backend one. Those are unfortunately not guaranteed to be stable. This patch does solve a real problem, though. I'll need to think about this for a bit.

In the mean time you can disable the use of precompiled headers either by passing --disable-pch to Meson when you first set up your project or with 'mesonconf -Dpch=false' afterwards. This allows you to use pch on setups that work and disable them for Clang.

from meson.

jpakkane avatar jpakkane commented on May 29, 2024

This is now in trunk. Hopefully clang devs will fix the include bug before changing -include-pch.

Thanks.

from meson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.