lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master a60c106c 07/13: Use clang's preprocessor


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a60c106c 07/13: Use clang's preprocessor
Date: Mon, 21 Nov 2022 17:29:18 -0500 (EST)

branch: master
commit a60c106c00e3f31ea2fe227bafe59ca5bf20e980
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use clang's preprocessor
    
    The preprocessor, traditionally $CPP, is not explicitly used by any lmi
    makefile; therefore, it is unspecified for clang.
    
    The technique lmi uses to generate autodependency files relies on the
      -MMD -MP -MT -MF
    options of the gcc preprocessor, which is invoked as $GNU_CPP even with
    compilers incompatible with gcc that lack those options; but clang's
    preprocessor deliberately supports those options for compatibility with
    gcc's; therefore, it is used for that purpose.
    
    Clang provides a separate 'clang-cpp-*' preprocessor, but at least in
    debian it's versioned: e.g., 'clang-cpp-13' exists today in 'bookworm',
    but there's no generic 'clang-cpp'. Therefore, '$(CXX) -E' is used here,
    on the assumption that the C++ compiler's preprocessor works correctly
    for C source files (at least for autodependencies).
---
 compiler_clang_version.make | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler_clang_version.make b/compiler_clang_version.make
index da60f7f1..ac67fb7e 100644
--- a/compiler_clang_version.make
+++ b/compiler_clang_version.make
@@ -27,7 +27,7 @@ $(srcdir)/compiler_clang_version.make:: ;
 
 AR      := ar
 CC      := clang
-CPP     := cpp
+#CPP    # Not used.
 CXX     := clang++
 LD      := clang++
 # For GNU/Linux, $(RC) is never invoked.
@@ -42,5 +42,5 @@ RC      := windres
 # Override these definitions to specify GNU tools when using an
 # incompatible toolchain.
 
-GNU_CPP := $(CPP)
+GNU_CPP := $(CXX) -E
 GNU_CXX := $(CXX)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]