From: stephan Date: Mon, 7 Apr 2025 02:08:55 +0000 (+0000) Subject: Make it legal to call proj-fatal from the global scope. X-Git-Tag: major-release~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d83ed04b11e7b7353f161f2ab706b4b88ec3c92;p=thirdparty%2Fsqlite.git Make it legal to call proj-fatal from the global scope. FossilOrigin-Name: f1cf373b73f0e97767d6f3c9dd78ce04360eae1ed22f74bea4aeb922f3ca5b5b --- diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index bfbf4716a8..f17ee37e86 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -74,18 +74,18 @@ set proj_(isatty) [isatty? stdout] # @proj-warn msg # # Emits a warning message to stderr. -proc proj-warn {msg} { +proc proj-warn {args} { show-notices - puts stderr "WARNING: $msg" + puts stderr "WARNING: $args" } ######################################################################## # @proj-error msg # # Emits an error message to stderr and exits with non-0. -proc proj-fatal {msg} { +proc proj-fatal {args} { show-notices - puts stderr "ERROR: \[[proj-current-proc-name 1]]: $msg" + puts stderr "ERROR: \[[proj-current-proc-name 1]]: $args" exit 1 } @@ -115,11 +115,11 @@ proc proj-assert {script {msg ""}} { # If this function believes that the current console might support # ANSI escape sequences then this returns $str wrapped in a sequence # to bold that text, else it returns $str as-is. -proc proj-bold {str} { +proc proj-bold {args} { if {$::autosetup(iswin) || !$::proj_(isatty)} { return $str } - return "\033\[1m${str}\033\[0m" + return "\033\[1m${args}\033\[0m" } ######################################################################## @@ -1417,10 +1417,17 @@ proc proj-get-env {var {dflt ""}} { # # Returns the name of the _calling_ proc from ($lvl + 1) levels up the # call stack (where the caller's level will be 1 up from _this_ -# call). It is not legal to call this from the top scope. +# call). If $lvl would resolve to global scope (or lower) then "global +# scope" is returned. proc proj-current-proc-name {{lvl 0}} { #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} - lindex [info level [expr {-$lvl - 1}]] 0 + set ilvl [info level] + set offset [expr {-$lvl - 1}] + if {[expr {$ilvl + $offset}] <= 0} { + return "global scope" + } else { + return lindex [info level $offset] 0 + } } diff --git a/manifest b/manifest index 34fae79b17..af4e5af960 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scode\stypo\sintroduced\sby\s[b57e3c3db00a6bc6]\sand\sreported\sby\n[forum:/forumpost/09957d8b2a|forum\spost\s09957d8b2a]. -D 2025-04-06T10:22:26.621 +C Make\sit\slegal\sto\scall\sproj-fatal\sfrom\sthe\sglobal\sscope. +D 2025-04-07T02:08:55.545 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -51,7 +51,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 06ba9f7841e848cdebef11fe61e6e959e3e379b974edadc5eac8a76fd6885bb5 +F autosetup/proj.tcl 58800d7837f192a5457352a7b1b30dab610633dc9f656fe73644a3a49818aa08 F autosetup/sqlite-config.tcl 26fd6bca350a88a92253afdf02ddea0fa1f304ff18325a41f30478f7c0f10175 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2216,8 +2216,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 0e98bbddc7b5e39310a8bf345521d05fdbcc906e279c23aa24cf30489ceeeff8 -R 4ac80589d29845f42febfbd0c1aff7a6 -U drh -Z b03b8aeb0a4ead4233bdc4e4a1e00244 +P f3a6cdb89b13bc173cfce9526f836600469b0242fe62b8f92f8747896d7d47bb +R 7d67250d55da7e76d1914ae111cc9674 +U stephan +Z 19a4bbe3c3a5475c934efcf9544f10b0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 656e0da598..7f183ca5a0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3a6cdb89b13bc173cfce9526f836600469b0242fe62b8f92f8747896d7d47bb +f1cf373b73f0e97767d6f3c9dd78ce04360eae1ed22f74bea4aeb922f3ca5b5b