]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Latest side-stream autosetup/proj.tcl for improved compile-commands feature detection.
authorstephan <stephan@noemail.net>
Mon, 1 Sep 2025 13:01:20 +0000 (13:01 +0000)
committerstephan <stephan@noemail.net>
Mon, 1 Sep 2025 13:01:20 +0000 (13:01 +0000)
FossilOrigin-Name: 55744ca8b8f2f95ba8bd3e01ef89e21e26c8547912c9d5637afe772d17f34486

autosetup/proj.tcl
manifest
manifest.uuid

index bf055ace100811afeaaa84463aaf0884844d3efa..6e78d876bee975536dd1266c64824ee0b630217f 100644 (file)
@@ -706,11 +706,20 @@ proc proj-file-write {args} {
 }
 
 #
-# @proj-check-compile-commands ?configFlag?
+# @proj-check-compile-commands ?-assume-for-clang? ?configFlag?
 #
-# Checks the compiler for compile_commands.json support. If passed an
-# argument it is assumed to be the name of an autosetup boolean config
-# which controls whether to run/skip this check.
+# Checks the compiler for compile_commands.json support. If
+# $configFlag is not empty then it is assumed to be the name of an
+# autosetup boolean config which controls whether to run/skip this
+# check.
+#
+# If -assume-for-clang is provided and $configFlag is not empty and CC
+# matches *clang* and no --$configFlag was explicitly provided to the
+# configure script then behave as if --$configFlag had been provided.
+# To disable that assumption, either don't pass -assume-for-clang or
+# pass --$configFlag=0 to the configure script. (The reason for this
+# behavior is that clang supports compile-commands but some other
+# compilers report false positives with these tests.)
 #
 # Returns 1 if supported, else 0, and defines HAVE_COMPILE_COMMANDS to
 # that value. Defines MAKE_COMPILATION_DB to "yes" if supported, "no"
@@ -718,12 +727,38 @@ proc proj-file-write {args} {
 # HAVE_COMPILE_COMMANDS is preferred.
 #
 # ACHTUNG: this test has a long history of false positive results
-# because of compilers reacting differently to the -MJ flag.
-#
-proc proj-check-compile-commands {{configFlag {}}} {
+# because of compilers reacting differently to the -MJ flag.  Because
+# of this, it is recommended that this support be an opt-in feature,
+# rather than an on-by-default default one. That is: in the
+# configure script define the option as
+# {--the-flag-name=0 => {Enable ....}}
+#
+proc proj-check-compile-commands {args} {
+  set i 0
+  set configFlag {}
+  set fAssumeForClang 0
+  set doAssume 0
   msg-checking "compile_commands.json support... "
-  if {"" ne $configFlag && ![proj-opt-truthy $configFlag]} {
-    msg-result "explicitly disabled"
+  if {"-assume-for-clang" eq [lindex $args 0]} {
+    lassign $args - configFlag
+    incr fAssumeForClang
+  } elseif {1 == [llength $args]} {
+    lassign $args configFlag
+  } else {
+    proj-error "Invalid arguments"
+  }
+  if {1 == $fAssumeForClang && "" ne $configFlag} {
+    if {[string match *clang* [get-define CC]]
+        && ![proj-opt-was-provided $configFlag]
+        && ![proj-opt-truthy $configFlag]} {
+      proj-indented-notice [subst -nocommands -nobackslashes {
+        CC appears to be clang, so assuming that --$configFlag is likely
+        to work. To disable this assumption use --$configFlag=0.}]
+      incr doAssume
+    }
+  }
+  if {!$doAssume && "" ne $configFlag && ![proj-opt-truthy $configFlag]} {
+    msg-result "check disabled. Use --${configFlag} to enable it."
     define HAVE_COMPILE_COMMANDS 0
     define MAKE_COMPILATION_DB no
     return 0
@@ -732,7 +767,7 @@ proc proj-check-compile-commands {{configFlag {}}} {
       # This test reportedly incorrectly succeeds on one of
       # Martin G.'s older systems. drh also reports a false
       # positive on an unspecified older Mac system.
-      msg-result "compiler supports compile_commands.json"
+      msg-result "compiler supports -MJ. Assuming it's useful for compile_commands.json"
       define MAKE_COMPILATION_DB yes; # deprecated
       define HAVE_COMPILE_COMMANDS 1
       return 1
index 75ee138a0bbb0c06fb59e8fa60d8cc448695b51f..4bc03108fdea23a1dce6def6be3623e907b7d77d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sline-wrap\schange\smade\sin\s[50234bc9e9fe58da]\swhich\sbroke\sthe\sdocsrc\sbuild\sby\ssplitting\sa\slink\sreference\sacross\stwo\slines,\swhich\sthe\sdoc\sprocessor\sdoes\snot\slike.\sProblem\sreported\sin\s[forum:ea1fe5f421549899\s|\sforum\spost\sea1fe5f4215].
-D 2025-09-01T00:32:43.056
+C Latest\sside-stream\sautosetup/proj.tcl\sfor\simproved\scompile-commands\sfeature\sdetection.
+D 2025-09-01T13:01:20.088
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -46,7 +46,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e
 F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
 F autosetup/jimsh0.c 563b966c137a4ce3c9333e5196723b7ac0919140a9d7989eb440463cd855c367
 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl 3418e01d9c83e8eed28ede96e41a3197bc6991655dc04d69fd328b65bfa1df7d
+F autosetup/proj.tcl 0582bccdd45ae01f4f6874bdc84109648869b1e09c9746402de176f63cd8044e
 F autosetup/sqlite-config.tcl f2d2cf0917a17068ab2897b2009e31a05a4481a0786cd6ea15f643fef325bbe3
 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
 F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
@@ -2171,8 +2171,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 4ac774364b693a4b992c997c64bf425e2765133a7a25963cbf2b02c180eeaba5
-R beb89ff30bf66d0f2716e8e2c62ea507
+P 321938063e2d6c579b992bbbed5210c8a051a8b2fe858bb88f95dbd8fb0f35dc
+R e267cd26b1b9022ad2ef2c0d79c6fc0b
 U stephan
-Z 9d54bf9cfd5b8af6bd11b0c714f7bf36
+Z d017608f1f8f249c42675a4c86d9b660
 # Remove this line to create a well-formed Fossil manifest.
index d9e1c0b0f3cd39faf8969a6c33e09e4b198751c7..41be768f0c4ce9ce2d505322f04cb4b1fa36e48b 100644 (file)
@@ -1 +1 @@
-321938063e2d6c579b992bbbed5210c8a051a8b2fe858bb88f95dbd8fb0f35dc
+55744ca8b8f2f95ba8bd3e01ef89e21e26c8547912c9d5637afe772d17f34486