Simplify usage of proj-assert by making the expr prefix implicit. Add an optional description arg to proj-assert, defaulting to the body of the assertion script.
FossilOrigin-Name: ada7b36c37c59ea02e54462b0eb8b93ff6ab45863edfd67b19f1e1a7bb2f97de
This commit is contained in:
parent
5c792a484d
commit
e9b04e524b
10
auto.def
10
auto.def
@ -543,7 +543,7 @@ proc sqlite-check-tcl {} {
|
||||
# TODO: document the steps this is taking.
|
||||
global srcdir
|
||||
msg-result "Checking for a suitable tcl... "
|
||||
proj-assert {proj-opt-truthy tcl}
|
||||
proj-assert [proj-opt-truthy tcl]
|
||||
set use_tcl 1
|
||||
set with_tclsh [opt-val with-tclsh]
|
||||
set with_tcl [opt-val with-tcl]
|
||||
@ -635,7 +635,7 @@ proc sqlite-check-tcl {} {
|
||||
if {"" eq $with_tclsh && $cfg ne ""} {
|
||||
# We have tclConfig.sh but no tclsh. Attempt to locate a tclsh
|
||||
# based on info from tclConfig.sh.
|
||||
proj-assert {expr {"" ne [get-define TCL_EXEC_PREFIX]}}
|
||||
proj-assert {"" ne [get-define TCL_EXEC_PREFIX]}
|
||||
set with_tclsh [get-define TCL_EXEC_PREFIX]/bin/tclsh[get-define TCL_VERSION]
|
||||
if {![file-isexec $with_tclsh]} {
|
||||
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
|
||||
@ -691,7 +691,7 @@ proc sqlite-check-tcl {} {
|
||||
proj-fatal "TCL support was requested but no tclConfig.sh could be found."
|
||||
}
|
||||
if {"" eq $cfg} {
|
||||
proj-assert {expr {0 == [get-define HAVE_TCL]}}
|
||||
proj-assert {0 == [get-define HAVE_TCL]}
|
||||
proj-indented-notice {
|
||||
WARNING: Cannot find a usable tclConfig.sh file. Use
|
||||
--with-tcl=DIR to specify a directory where tclConfig.sh can be
|
||||
@ -1042,8 +1042,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}}}
|
||||
proj-assert {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}
|
||||
proj-assert {$editLibName in {readline editline}}
|
||||
sqlite-add-shell-opt -D${editLibDef}=1
|
||||
msg-result "Using $editLibName flags: $rlInc $rlLib"
|
||||
# Check whether rl_completion_matches() has a signature we can use
|
||||
|
@ -77,14 +77,21 @@ proc proj-fatal {msg} {
|
||||
########################################################################
|
||||
# @proj-assert script
|
||||
#
|
||||
# Kind of like a C assert if uplevel (eval) of $script is false,
|
||||
# triggers a fatal error.
|
||||
proc proj-assert {script} {
|
||||
# Kind of like a C assert: if uplevel (eval) of [expr {$script}] is
|
||||
# false, a fatal error is triggered. The error message, by default,
|
||||
# includes the body of the failed assertion, but if $descr is set then
|
||||
# that is used instead.
|
||||
proc proj-assert {script {descr ""}} {
|
||||
if {1 == [get-env proj-assert 0]} {
|
||||
msg-result [proj-bold "asserting: [string trim $script]"]
|
||||
msg-result [proj-bold "asserting: $script"]
|
||||
}
|
||||
if {![uplevel 1 $script]} {
|
||||
proj-fatal "Assertion failed: $script"
|
||||
set x {expr }
|
||||
append x \{ $script \}
|
||||
if {![uplevel 1 $x]} {
|
||||
if {"" eq $descr} {
|
||||
set descr $script
|
||||
}
|
||||
proj-fatal "Assertion failed: $descr"
|
||||
}
|
||||
}
|
||||
|
||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Remove\sthree\sunused\sfiles\sfrom\sautosetup/.
|
||||
D 2024-11-09T09:19:29.627
|
||||
C Simplify\susage\sof\sproj-assert\sby\smaking\sthe\sexpr\sprefix\simplicit.\sAdd\san\soptional\sdescription\sarg\sto\sproj-assert,\sdefaulting\sto\sthe\sbody\sof\sthe\sassertion\sscript.
|
||||
D 2024-11-09T10:23:04.469
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
|
||||
@ -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 a492afaded87fafe42d8918feea2ecab350255f67ad10aabfde1d24ba4b3abd9
|
||||
F auto.def 79e9b88684035320ba6cba53c1d6117320ff9cb937286179d0408fb69716e482
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
|
||||
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
|
||||
@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d
|
||||
F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f
|
||||
F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14
|
||||
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
|
||||
F autosetup/proj.tcl 93e1d99ffa8a75fe2f488605c4d36cb57a75f1500bccc5c5954ae45eb7da89d7
|
||||
F autosetup/proj.tcl 6b7939cc1afbef71327c684999278b0a0f71e9c6ad39b7a27b3e79101a0c67de
|
||||
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
|
||||
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
|
||||
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
|
||||
@ -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 53a71981abf5aaca01e86ff87c3779d7dcc6661c80e1f2bf74515f49993b6a0d
|
||||
R 7277c238d4f5631fe2de582f05e930b6
|
||||
P 906563a7e07fca81effb31a77ee5d7cdacd4cc6157e16e1139da70c92716869a
|
||||
R 80ec48dbf7e84a814515b0c1aedd20af
|
||||
U stephan
|
||||
Z 343d6685aa510740ee80b7b0b05658f8
|
||||
Z 18ce4bb625331a3aaef20d9b98a0b830
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
906563a7e07fca81effb31a77ee5d7cdacd4cc6157e16e1139da70c92716869a
|
||||
ada7b36c37c59ea02e54462b0eb8b93ff6ab45863edfd67b19f1e1a7bb2f97de
|
||||
|
Loading…
Reference in New Issue
Block a user