From e7017237c9d842b4cebdcfb13526cd71a2b2836a Mon Sep 17 00:00:00 2001 From: Stefan Eßer Date: Sat, 28 Jan 2023 21:02:27 +0100 Subject: vendor/bc: import version 6.2.0 This is a production release with a new feature and a few bug fixes. The bug fixes include: - A crash when bc and dc are built using editline, but history is not activated. - A missing local in the uint*() family of functions in the extended math library. - A failure to clear the tail call list in dc on error. - A crash when attempting to swap characters in command-line history when no characters exist. - SIGWINCH was activated even when history was not. The new feature is that stack traces are now given for runtime errors. In debug mode, the C source file and line of errors are given as well. --- include/lex.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'include/lex.h') diff --git a/include/lex.h b/include/lex.h index 160c0f114855..54d704f8b447 100644 --- a/include/lex.h +++ b/include/lex.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2021 Gavin D. Howard and contributors. + * Copyright (c) 2018-2023 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -43,10 +43,30 @@ #include #include -// Two convencience macros for throwing errors in lex code. They take care of -// plumbing like passing in the current line the lexer is on. +/** + * A convenience macro for throwing errors in lex code. This takes care of + * plumbing like passing in the current line the lexer is on. + * @param l The lexer. + * @param e The error. + */ +#ifndef NDEBUG +#define bc_lex_err(l, e) (bc_vm_handleError((e), __FILE__, __LINE__, (l)->line)) +#else // NDEBUG #define bc_lex_err(l, e) (bc_vm_handleError((e), (l)->line)) +#endif // NDEBUG + +/** + * A convenience macro for throwing errors in lex code. This takes care of + * plumbing like passing in the current line the lexer is on. + * @param l The lexer. + * @param e The error. + */ +#ifndef NDEBUG +#define bc_lex_verr(l, e, ...) \ + (bc_vm_handleError((e), __FILE__, __LINE__, (l)->line, __VA_ARGS__)) +#else // NDEBUG #define bc_lex_verr(l, e, ...) (bc_vm_handleError((e), (l)->line, __VA_ARGS__)) +#endif // NDEBUG // BC_LEX_NEG_CHAR returns the char that corresponds to negative for the // current calculator. -- cgit v1.3