Author: brane
Date: Sun May 18 05:35:38 2025
New Revision: 1925657

URL: http://svn.apache.org/viewvc?rev=1925657&view=rev
Log:
Follow up to r1925652: Fix a duplicate directives in .clangd, and generate
complete, separate sets of options for C and C++.

* configure.ac
  (--enable-clangd): Fix the PathMatch directives.
  (svn_dot_clangdcc_contents): Renamed from svn_dot_clangd_contents.
  (SVN_DOT_CLANGD_CC): Renamed from SVN_DOT_CLANGD.
  (SVN_DOT_CLANGD_CXX): Renamed from SVN_DOT_CLANGDXX.
  (SVN_DOT_CLANGD): New; adds to both C and C++ fragments in .clangd.
  Top level: Added maintainer flags and debug macros to .clangd.

* build/ac-macros/ax_boost_base.m4: Use renamed SVN_DOT_CLANGD_CXX.

* build/ac-macros/compiler.m4
  (SVN_CC_MODE_SETUP): Use SVN_DOT_CLANGD_CC. Add warning flags to .clangd.
  (SVN_CXX_MODE_SETUP): Use SVN_DOT_CLANGD_CXX, and add warning flags.

Modified:
    subversion/trunk/build/ac-macros/ax_boost_base.m4
    subversion/trunk/build/ac-macros/compiler.m4
    subversion/trunk/configure.ac

Modified: subversion/trunk/build/ac-macros/ax_boost_base.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/ax_boost_base.m4?rev=1925657&r1=1925656&r2=1925657&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/ax_boost_base.m4 (original)
+++ subversion/trunk/build/ac-macros/ax_boost_base.m4 Sun May 18 05:35:38 2025
@@ -291,7 +291,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
         ifelse([$3], , :, [$3])
     else
         AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
-        SVN_DOT_CLANGDXX([$BOOST_CPPFLAGS])
+        SVN_DOT_CLANGD_CXX([$BOOST_CPPFLAGS])
         # execute ACTION-IF-FOUND (if present):
         ifelse([$2], , :, [$2])
     fi

Modified: subversion/trunk/build/ac-macros/compiler.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/compiler.m4?rev=1925657&r1=1925656&r2=1925657&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/compiler.m4 (original)
+++ subversion/trunk/build/ac-macros/compiler.m4 Sun May 18 05:35:38 2025
@@ -73,16 +73,16 @@ AC_DEFUN([SVN_CC_MODE_SETUP],
 
   CMODEFLAGS="$CFLAGS"
   CFLAGS=""
+  SVN_DOT_CLANGD_CC([$CMODEFLAGS])
 
   if test "$GCC" = "yes"; then
     dnl Find flags to silence all warnings
-    SVN_CFLAGS_ADD_IFELSE([-w])
+    SVN_CFLAGS_ADD_IFELSE([-w],[SVN_DOT_CLANGD_CC([-w])])
   fi
 
   CNOWARNFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS_KEEP"
 
-  SVN_DOT_CLANGD([$CMODEFLAGS])
   AC_SUBST(CMODEFLAGS)
   AC_SUBST(CNOWARNFLAGS)
   AC_SUBST(CMAINTAINERFLAGS)
@@ -90,7 +90,9 @@ AC_DEFUN([SVN_CC_MODE_SETUP],
 
   if test "$GCC" = "yes"; then
     dnl Tell clang to not accept unknown warning flags
-    SVN_CFLAGS_ADD_IFELSE([-Werror=unknown-warning-option])
+    SVN_CFLAGS_ADD_IFELSE([-Werror=unknown-warning-option],[
+      SVN_DOT_CLANGD_CC([-Werror=unknown-warning-option])
+    ])
   fi
 ])
 
@@ -134,16 +136,16 @@ AC_DEFUN([SVN_CXX_MODE_SETUP],
 
   CXXMODEFLAGS="$CXXFLAGS"
   CXXFLAGS=""
+  SVN_DOT_CLANGD_CXX([$CXXMODEFLAGS])
 
   if test "$GXX" = "yes"; then
     dnl Find flags to silence all warnings
-    SVN_CXXFLAGS_ADD_IFELSE([-w])
+    SVN_CXXFLAGS_ADD_IFELSE([-w],[SVN_DOT_CLANGD_CXX([-w])])
   fi
 
   CXXNOWARNFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS_KEEP"
 
-  SVN_DOT_CLANGDXX([$CXXMODEFLAGS])
   AC_SUBST(CXXMODEFLAGS)
   AC_SUBST(CXXNOWARNFLAGS)
   AC_SUBST(CXXMAINTAINERFLAGS)
@@ -151,6 +153,8 @@ AC_DEFUN([SVN_CXX_MODE_SETUP],
 
   if test "$GXX" = "yes"; then
     dnl Tell clang++ to not accept unknown warning flags
-    SVN_CXXFLAGS_ADD_IFELSE([-Werror=unknown-warning-option])
+    SVN_CXXFLAGS_ADD_IFELSE([-Werror=unknown-warning-option],[
+      SVN_DOT_CLANGD_CXX([-Werror=unknown-warning-option])
+    ])
   fi
 ])

Modified: subversion/trunk/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1925657&r1=1925656&r2=1925657&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Sun May 18 05:35:38 2025
@@ -54,36 +54,35 @@ AC_HELP_STRING([--enable-dot-clangd],
                [Generate a .clangd file at the root of the source tree]),
 [
   AC_MSG_NOTICE([Creating $svn_dot_clangd_file])
-  svn_dot_clangd_contents='---
+  svn_dot_clangdcc_contents='---
+# C
 If:
-  PathMatch: .*\.c
-  PathMatch: .*\.h
-  PathExclude: subversion/bindings/javahl/native/.*
+  PathMatch: [.*\.[ch]]
+  PathExclude: [subversion/bindings/javahl/native/.*]
 
 CompileFlags:
   Add:'
 
   svn_dot_clangdxx_contents='---
+# C++
 If:
-  PathMatch: .*\.cpp
-  PathMatch: .*\.hpp
-  PathMatch: subversion/bindings/javahl/native/.*\.h
+  PathMatch: [.*\.[ch]pp|.*/bindings/javahl/native/.*\.h]
 
 CompileFlags:
   Add:'
 ],
 [])
 
-AC_DEFUN([SVN_DOT_CLANGD],
+AC_DEFUN([SVN_DOT_CLANGD_CC],
 [
-  if test "x$svn_dot_clangd_contents" != "x"; then
+  if test "x$svn_dot_clangdcc_contents" != "x"; then
     indent="    -"
     dnl Split multiple flags to one per line.
     set fake [$1]
     while test "${#}" -gt 1; do
       line="${2}"; shift
-      svn_dot_clangd_contents=`cat <<EOF
-$svn_dot_clangd_contents
+      svn_dot_clangdcc_contents=`cat <<EOF
+$svn_dot_clangdcc_contents
 $indent $line
 EOF
       `
@@ -91,7 +90,7 @@ EOF
   fi
 ])
 
-AC_DEFUN([SVN_DOT_CLANGDXX],
+AC_DEFUN([SVN_DOT_CLANGD_CXX],
 [
   if test "x$svn_dot_clangdxx_contents" != "x"; then
     indent="    -"
@@ -108,17 +107,22 @@ EOF
   fi
 ])
 
+AC_DEFUN([SVN_DOT_CLANGD],[
+  SVN_DOT_CLANGD_CC([$1])
+  SVN_DOT_CLANGD_CXX([$1])
+])
+
 
 dnl Add well-known source and build paths to .clangd
 SVN_DOT_CLANGD([-I$abs_builddir/subversion])
 SVN_DOT_CLANGD([-I$abs_srcdir/subversion/include])
 SVN_DOT_CLANGD([-I$abs_srcdir/subversion/tests])
-SVN_DOT_CLANGDXX([-I$abs_srcdir/subversion/bindings/cxx/include])
-SVN_DOT_CLANGDXX([-I$abs_srcdir/subversion/bindings/cxx/tests])
-SVN_DOT_CLANGDXX([-I$abs_srcdir/subversion/bindings/javahl/native])
 SVN_DOT_CLANGD([-I$abs_srcdir/subversion/bindings/swig/perl/libsvn_swig_perl])
 SVN_DOT_CLANGD([-I$abs_srcdir/subversion/bindings/swig/python/libsvn_swig_py])
 SVN_DOT_CLANGD([-I$abs_srcdir/subversion/bindings/swig/ruby/libsvn_swig_ruby])
+SVN_DOT_CLANGD_CXX([-I$abs_srcdir/subversion/bindings/cxx/include])
+SVN_DOT_CLANGD_CXX([-I$abs_srcdir/subversion/bindings/cxx/tests])
+SVN_DOT_CLANGD_CXX([-I$abs_srcdir/subversion/bindings/javahl/native])
 
 # ==== Check for programs ====================================================
 
@@ -1152,6 +1156,7 @@ AS_HELP_STRING([--enable-maintainer-mode
 
         dnl Add flags that all versions of GCC (should) support
         CMAINTAINERFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wshadow 
-Wformat=2 -Wunused -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wno-multichar -Wredundant-decls -Wnested-externs 
-Winline -Wno-long-long -Wbad-function-cast $CMAINTAINERFLAGS"
+        SVN_DOT_CLANGD_CC([$CMAINTAINERFLAGS])
       fi
       if test "$GXX" = "yes"; then
         AC_MSG_NOTICE([maintainer-mode: adding G++ warning flags])
@@ -1170,6 +1175,7 @@ AS_HELP_STRING([--enable-maintainer-mode
 
         dnl Add flags that all versions of G++ (should) support
         CXXMAINTAINERFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wshadow 
-Wunused -Wunreachable-code $CXXMAINTAINERFLAGS"
+        SVN_DOT_CLANGD_CXX([$CXXMAINTAINERFLAGS])
       fi
     fi
 ])
@@ -1205,6 +1211,7 @@ if test "$enable_debugging" = "yes" ; th
   dnl AP_DEBUG enables specific (Apache) features for developer builds
   CFLAGS="$CFLAGS -DSVN_DEBUG -DAP_DEBUG"
   CXXFLAGS="$CXXFLAGS -DSVN_DEBUG -DAP_DEBUG"
+  SVN_DOT_CLANGD([-DSVN_DEBUG -DAP_DEBUG])
 elif test "$enable_debugging" = "no" ; then
   AC_MSG_NOTICE([Disabling debugging])
   CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-g[0-9] //g' -e 's/-g //g'`"]
@@ -1212,6 +1219,7 @@ elif test "$enable_debugging" = "no" ; t
   dnl Compile with NDEBUG to get rid of assertions
   CFLAGS="$CFLAGS -DNDEBUG"
   CXXFLAGS="$CXXFLAGS -DNDEBUG"
+  SVN_DOT_CLANGD([-DNDEBUG])
 # elif test "$enable_debugging" = "maybe" ; then
 #   # do nothing
 fi
@@ -1858,14 +1866,14 @@ AC_DEFINE_UNQUOTED([SVN_BUILD_TARGET], "
 AC_OUTPUT
 
 # ==== Generate the .clangd file =============================================
-if test "x$svn_dot_clangd_contents$svn_dot_clangdxx_contents" = "x" ; then
+if test "x$svn_dot_clangdcc_contents$svn_dot_clangdxx_contents" = "x" ; then
    if test -f "$svn_dot_clangd_file"; then
       AC_MSG_NOTICE([Removing $svn_dot_clangd_file])
       rm -f "$svn_dot_clangd_file"
    fi
 else
   AC_MSG_NOTICE([Writing $svn_dot_clangd_file])
-  echo "$svn_dot_clangd_contents" > "$svn_dot_clangd_file"
+  echo "$svn_dot_clangdcc_contents" > "$svn_dot_clangd_file"
   echo "$svn_dot_clangdxx_contents" >> "$svn_dot_clangd_file"
 fi
 


Reply via email to