This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=db649e3393dfb1a2f903871d4a4d5cf62c654c59

commit db649e3393dfb1a2f903871d4a4d5cf62c654c59
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Jun 4 23:54:54 2023 +0200

    build: Add support for compiler analyzer flags
    
    This is intended for development use, and not to be enabled
    unconditionally, as it can generate large amounts of false positives,
    that require sentient triage intervention.
---
 configure.ac        |  1 +
 m4/dpkg-compiler.m4 | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4f1a98ca4..d1fa8357d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,6 +221,7 @@ DPKG_USE_DISK_PREALLOCATE
 AC_DEFINE([LIBDPKG_VOLATILE_API], [1], [Acknowledge the volatility of the 
API.])
 DPKG_COMPILER_WARNINGS
 DPKG_COMPILER_SANITIZER
+DPKG_COMPILER_ANALYZER
 DPKG_COMPILER_OPTIMIZATIONS
 DPKG_LINKER_OPTIMIZATIONS
 DPKG_ARCHITECTURE
diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index 1e9cd6597..69a8b872a 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -169,6 +169,30 @@ AC_DEFUN([DPKG_COMPILER_SANITIZER], [
   ])
 ])
 
+# DPKG_COMPILER_ANALYZER
+# ----------------------
+# Add configure option to enable compiler analyzer support options.
+# Note: This is only intended for development use, as enabling this option
+# unconditionally can generate large amounts of false positivies that
+# require sentient triage intervention.
+AC_DEFUN([DPKG_COMPILER_ANALYZER], [
+  AC_ARG_ENABLE([compiler-analyzer],
+    [AS_HELP_STRING([--enable-compiler-analyzer],
+      [Enable compiler analyzer support])],
+    [], [enable_compiler_analyzer=no])
+
+  AS_IF([test "x$enable_compiler_analyzer" = "xyes"], [
+    DPKG_CHECK_COMPILER_FLAG([-fanalyzer])
+    AC_LANG_PUSH([C++])
+    DPKG_CHECK_COMPILER_FLAG([-fanalyzer])
+    AC_LANG_POP([C++])
+
+    LDFLAGS="$COMPILER_CFLAGS $LDFLAGS"
+    CFLAGS="$COMPILER_CFLAGS $CFLAGS"
+    CXXFLAGS="$COMPILER_CXXFLAGS $CXXFLAGS"
+  ])
+])
+
 # DPKG_COMPILER_OPTIMIZATIONS
 # ---------------------------
 # Add configure option to disable optimizations.

-- 
Dpkg.Org's dpkg

Reply via email to