From 13e735a5b5b6c2722d22349f51548db00ee4e9b2 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 29 Oct 2024 08:14:34 +0000 Subject: [PATCH] Add proj-assert proc and add a couple of asserts to the editline/readline checks. FossilOrigin-Name: db9870caa806c902cae033a96fec48db1b2d78b96b124e568479c5326e006c9b --- auto.def | 10 +++++++--- autosetup/proj.tcl | 9 +++++++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/auto.def b/auto.def index c3d895aa22..f25de85bb7 100644 --- a/auto.def +++ b/auto.def @@ -742,9 +742,9 @@ proc sqlite-check-line-editing {} { define LDFLAGS_READLINE "" define CFLAGS_READLINE "" set libsForReadline {readline edit} ; # -l names to check for readline() - set check [opt-val with-linenoise] set editLibName "readline" ; # "readline" or "editline" set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE" + set check [opt-val with-linenoise] if {"" ne $check} { # Use linenoise... set dirLn $check @@ -769,8 +769,10 @@ proc sqlite-check-line-editing {} { # # shell.c historically expects HAVE_EDITLINE to be set for # libedit, but it then expects to see , which - # some system's don't actually have, despite having libedit. Thus - # we trick shell.c into using editline by posing as readline. + # some system's don't actually have, despite having libedit. If we + # end up finding below, we will use + # -DHAVE_EDITLINE=1, else we will use -DHAVE_READLINE=1. In either + # case, we will link against libedit. set libsForReadline {edit} set editLibName editline } elseif {![opt-bool readline]} { @@ -864,6 +866,8 @@ proc sqlite-check-line-editing {} { set rlInc [join $rlInc] define LDFLAGS_READLINE $rlLib define CFLAGS_READLINE $rlInc + proj-assert {expr {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}} + proj-assert {expr {$editLibName in {readline editline}}} define $editLibDef 1 sqlite-add-shell-opt -D${editLibDef}=1 msg-result "Using $editLibName flags: $rlInc $rlLib" diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index e966b872e9..8f5335f77e 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -59,6 +59,15 @@ proc proj-fatal {msg} { exit 1 } +######################################################################## +# Kind of like a C assert if uplevel (eval) of $script is false, +# triggers a fatal error. +proc proj-assert {script} { + if {![uplevel 1 $script]} { + proj-fatal "Affirmation failed: $script" + } +} + ######################################################################## # If this function believes that the current console might support # ANSI escape sequences then this returns $str wrapped in a sequence diff --git a/manifest b/manifest index 5e66a9acec..1f94aa5d6b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Teach\sconfigure\s--editline\sto\sreport\sitself\sto\sshell.c\sas\seither\sHAVE_EDITLINE\sor\sHAVE_READLINE,\sdepending\son\swhich\sheaders\sare\savailable\s(editline/readline.h\sor\sreadline/readline.h,\sboth\sof\swhich\swork\sand\ssome\ssystems\sonly\shave\sthe\slatter),\sbut\sthen\slink\sagainst\slibedit\sregardless\sof\swhich\sone\sshell.c\sthinks\sit\sis\susing. -D 2024-10-29T08:01:56.226 +C Add\sproj-assert\sproc\sand\sadd\sa\scouple\sof\sasserts\sto\sthe\seditline/readline\schecks. +D 2024-10-29T08:14:34.309 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 446169b97de3492b54e2282f22cd0364a5579ec620617273c3b6e371650700ff +F auto.def 3ff5ee963e46a86cab5a56bfabefd95e9caa9dffbaf6c6fe76f0ff30510fc475 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -49,7 +49,7 @@ F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bd F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 986cad77e63672eb910aa2a040185f0ecf3590b5c4ff4d2a033cb791edb9445f +F autosetup/proj.tcl 2fcaa8ee431a72df5cd5c1122df356d67ab2c892ef613cff6ffeb86a7b7da8f3 F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e03c564aff6e3ac558f17670bfdd5fc129a8d33ec50975af843973152483e3fa -R d3a68de2e78347c35dd06cc7c4f435ff +P 85077b20e69ed269f8840bb900e823981bebd82063853fbf178b1af44a6951ba +R b5b0e6d951eff454ba00abe04bd51ebc U stephan -Z 03d95568b8712aa0747a4210f93cda01 +Z aa2a20cde06aa54503780a7e22fdad3b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0869312b92..70a6796c73 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -85077b20e69ed269f8840bb900e823981bebd82063853fbf178b1af44a6951ba +db9870caa806c902cae033a96fec48db1b2d78b96b124e568479c5326e006c9b