Commit graph

33 commits

Author SHA1 Message Date
Charles Zhang 7697509a0f Fix TAIL-ANNOTATE for the nth time.
There was in fact something wrong with every iteration of the comments
over the past 20 years. NS was right to want to make the XEP not
appear - XEPs are just the trampolines and showing them would make the
function appear twice. However, what actually inhibits the XEPs
appearance is always annotating tail-recursive *local calls* as tail,
even when it's non-returning, since XEPs local call the actual
function.

I think people got confused because of these two facets - there's the
XEP, as well as the main function. The XEP should always tail-call the
main function because we don't want it to show up in the backtrace
unless there's an actual error happening within the XEP (think
optional processing problems etc).

Also remove ALLOW-NON-RETURNING-TAIL-CALL. Not only is the function it
was originally written for gone, but it was inherently bogus: It
achieved function frame disappearance by making all non-returning
calls tail calls, even when they aren't in tail position. If the
intention is just to make the function not appear in the backtrace,
the debugger already has a facility to do that. Functions that just
call error do not need TCO per se, because, well, they aren't going to
consume more stack frames and don't need to be fast. Create a macro
helper to express the intent more clearly. We also avoid scanning
every single node in the component during tail annotation.

Also, some non-trivial functions were wrongly annotated with
ALLOW-NON-RETURNING-TAIL-CALL, hiding potentially useful local
variables. So, don't make those error wrappers.
2023-03-13 15:48:31 +01:00
Douglas Katzman 7991d1db3b Detect malformed special decl
Patch from pfdietz
2020-12-13 19:02:04 -05:00
Douglas Katzman 77038b9a9d Fix lp#1738638 2020-12-13 12:29:13 -05:00
Stas Boukarev e922093780 DEFMACRO: preserve &key defaults in nested destructuring.
Fixes lp#1876194
2020-05-01 17:13:36 +03:00
Stas Boukarev 438494ae98 Preserve &optional default values for macro lambda lists.
Reported by João Távora.
2017-09-19 19:08:36 +03:00
Jan Moringen 89027eb0f8 DESTRUCTURING-BIND treats non-toplevel () as nested empty pattern
Instead of as a wildcard pattern.

References
* http://www.lispworks.com/documentation/HyperSpec/Body/03_dd.htm
* http://www.lispworks.com/documentation/HyperSpec/Body/03_dda.htm
* http://www.lispworks.com/documentation/HyperSpec/Body/03_ddaa.htm

Reported by jackdaniel, |3b| and sjl in #sbcl
2017-09-01 14:36:27 +02:00
Jan Moringen d1f30a3dee tests: Better test names in lambda-list.pure.lisp 2017-09-01 14:36:27 +02:00
Jan Moringen 397b1a6979 Use CHECKED-COMPILE, fix test names in tests/lambda-list.pure.lisp 2017-07-15 15:42:33 +02:00
Douglas Katzman 278038f2bb Adjust test files for interpreted code.
The following categories of tests are not expected behaviors,
or would be "nice to have but can't" in the interpreter:
- explicitly unsafe code to explore edge cases
- inlining, use of compiler-macros
- non-consing (especially dx allocation)

A few places that appeared to assume that EVAL meant "compile"
are changed to call COMPILE.

The test driver will cons :INTERPRETER onto *FEATURES* around
each test file when actually interpreting, so that tests can
use :SKIPPED-ON instead of testing SB-EXT:*EVALUATOR-MODE*.

After this, an almost-fully-passing run of tests is possible
in the new interpreter; not nearly so in sb-eval though.
2015-10-19 08:36:28 -04:00
Douglas Katzman 51b71c3b07 Fix a couple "gotchas" regarding the more complainy lambda-list parser.
It would warn twice (or more) about methods with &OPTIONAL + &KEY.

Also silence various bits of test noise.
2015-09-22 20:55:13 -04:00
Douglas Katzman eb556fcf8a ARG-COUNT-ERROR function serves no purpose - remove it.
This was potentially called by each use of a destructuring-bind,
and the theory was that it was cheaper than passing keyword arguments.
This is no longer true, and it's not worth having another random
error-signaling function just to convert positional to keyword args
in at most two places.
Incidentally, the declaration in 'fndb' without SB!KERNEL:: was bogus.
2015-07-30 22:04:24 -04:00
Douglas Katzman 5dd6a19e73 &OPTIONAL + &KEY in ds-lambda lists should warn only once, not twice. 2015-07-11 00:47:37 -04:00
Douglas Katzman be5cb7ee13 Delete all remnants of parse-defmacro 2015-07-02 15:04:02 -04:00
Douglas Katzman a86cac2825 Change all but 1 last use of PARSE-DEFMACRO to MAKE-MACRO-LAMBDA. 2015-07-02 04:56:43 -04:00
Douglas Katzman eeecd71327 Style-warn if destructuring lambda list has &keyword in weird place. 2015-07-01 17:45:23 -04:00
Douglas Katzman 91683dac18 Preserve quoted constant defaults in UNPARSE-DS-LAMBDA-LIST
This is needed to make some sb-introspect tests pass
after pending changes to DESTRUCTURING-BIND et. al.
2015-06-29 22:12:27 -04:00
Douglas Katzman ec36d7fb1f Make ARG-COUNT-ERROR really tail call ERROR.
Instead of obscuring the fact that it couldn't.
2015-06-22 09:29:12 -04:00
Douglas Katzman 0685427b30 Next piece of the destructuring-bind improvements.
Mostly resembling the patch mailed to the group, with changes
per review: a rename or two plus lots more commentary.

The tests in lambda-list have been upgraded to test their
inputs two ways: using the AST matcher (a predicate that just
returns T/NIL), and a function that parses without pre-testing
for validity and which signals TYPE-ERROR at any point.
2015-06-17 15:07:35 -04:00
Douglas Katzman c3080aa582 Implement a sanity-check of defaulting forms in PARSE-DS-LAMBDA-LIST.
As this seems to be a point of confusion, we'll issue a style-warning
if it looks like a constant default form in &OPTIONAL / &KEY won't match
the destructuring pattern for which it provides the default.
2015-06-17 01:04:24 -04:00
Douglas Katzman 8289475b7a Some forward-looking changes for destructuring-bind.
- &OPTIONAL with no variables when unparsing a ds-lambda-list matters.
Otherwise the lambda list (A &OPTIONAL ((&OPTIONAL))) - which is merely "weird"
turns into (A &OPTIONAL (())) which is not only weird, but illegal,
because () is another spelling for NIL, and NIL is a constant.
The former lambda list takes 1 or 2 arguments. The 2nd argument, if supplied,
must be NIL, because it binds to a lambda that accepts zero things.

- Add DS-LAMBDA-LIST-SYMBOLS which extracts all bound symbols.
2015-06-16 18:44:55 -04:00
Douglas Katzman b14558a8b6 Remove "#." around calls to LAMBDA-LIST-KEYWORD-MASK.
Also use :ACCEPT, not :CONTEXT, to check if dotted tail is allowed;
and prefer LOGTEST to LOGBITP except for testing whether the
current state is in a set of states. No behavior change.
2015-06-13 11:18:43 -04:00
Douglas Katzman 9d4099af48 Add destructuring lambda-list parser/unparser + tests.
And rename BUILD-LAMBDA-LIST -> MAKE-LAMBDA-LIST.
2015-06-12 23:18:05 -04:00
Douglas Katzman 45abecd96b Unbreak clisp-hosted build, plus random whitespace removal. 2015-06-11 15:14:05 -04:00
Douglas Katzman ef0b7ba98e Add another sanity test to parse-lambda-list. 2015-06-11 00:29:42 -04:00
Douglas Katzman 66bc347e31 Use recently-added utility function. 2015-06-10 00:27:42 -04:00
Douglas Katzman 493fe08928 Remove unreachable code from MAKE-LAMBDA-VARS 2015-06-10 00:20:52 -04:00
Douglas Katzman 8de5da8cad Move 'parse-lambda-list' earlier in build, before parse-defmacro.
And return one fewer value from PARSE-LAMBDA-LIST since &MORE
can not co-occur with &REST; and unparse macro lambda lists
losslessly by distinguishing &BODY from &REST.
2015-06-09 14:32:32 -04:00
Douglas Katzman b65ccd9924 Be a little pedantic in tests that call COMPILE
Several tests were passing implicitly compiled lambdas, for lack of
a quote, which was a no-op at the explicit COMPILE, and one can imagine
that in some scenario the effect would not be precisely the same,
although in every case here it was in fact the same.
2015-01-15 11:43:33 -05:00
Stas Boukarev ed063cafbe Fix binding order of supplied-p parameters in macro lambda lists.
It was done at once before all other bindings were processed, while it
should be just after the binding to which supplied-p is related is
bound.

Fixes lp#721135.
2014-08-30 20:18:11 +04:00
Juho Snellman 970dd272dc 0.9.16.27:
Add an interpreting EVAL, for cases where the compiler is
        unsuitable due to e.g. compilation overhead.

        * The old EVAL is still the default. To use the new one,
          (SETF SB-EXT:*EVALUATOR-MODE* :INTERPRET).

          Making the interpreter the default might be the purer
          choice, since there's a standard way of ensuring that code
          is compiled, and no standard way of ensuring that it's
          not. On the other hand, there are practical reasons for
          keeping the compiler as the default. The interpreter is very
          slow, doesn't have proper debugger support (either for
          backtraces or inspecting frames), and it doesn't have
          stepper support.

        * The interpreter doesn't treat THE or type declarations for
          lexical variables as assertions. The regression tests that
          assume otherwise have been disabled when running in
          interpreted mode. The intepreter will however type-check the
          proclaimed types of specials.
2006-09-13 15:59:31 +00:00
William Harold Newman 4898ef32c6 0.9.2.43:
another slice of whitespace canonicalization
	(Anyone who ends up here with "cvs annotate" probably
		wants to look at the "tabby" tagged version.)
2005-07-14 16:30:05 +00:00
Nikodemus Siivola 2cf0f474c7 0.8.17.9: minor rollback (problems caught by the ansi-tests)
* Don't resignal errors from macroexpansion before calling
              error. Users that care should be hooking onto
              *macroexpand-hook* and handling things there.
2004-12-01 15:19:20 +00:00
Nikodemus Siivola 9f684145a9 0.8.17.4: Stricter lambda list parsing
* Order of &AUX vs. &KEY/&REST in destructuring
              lambda lists, check for multiple &optional, etc.
           * Resignal errors from macroexpansion before converting
              to COMPILED-PROGRAM-ERROR so that user code that
              wants to handle them can.
2004-11-30 11:21:42 +00:00