Releases: paul-j-lucas/cdecl
cdecl-18.6
Better "did you mean" suggestions
"Did you mean" suggestions now include all that are "similar enough," not only those that have the same Damerau-Levenshtein distance as the best suggestion.
--no-typedefs, -t option, twice
Specifying the -t option twice now suppresses predefining all types, even those normally required. (This is a debugging aid for developers of cdecl itself. Certain results willl be incorrect.)
East-const _Atomic
When in east-const mode, _Atomic is now also printed east.
_Atomic void parameters
Such parameters are now also correctly flagged as illegal.
Color prompts
Initial color prompts have been fixed.
Multiline comments
Multiline C-style comments /* */ are now supported (mostly).
cdecl-18.5
[[indeterminate]]
Added support for C++26 indeterminate attribute.
C++26 types
Added the predefined types std::hazard_pointer, std::hive_limits, std::rcu_domain, std::text_encoding, std::contracts::assertion_kind, std::contracts::contract_violation, std::contracts::detection_mode, std::contracts::evaluation_semantic, std::linalg::column_major_t, std::linalg::explicit_diagonal_t, std::linalg::implicit_unit_diagonal_t, std::linalg::lower_triangle_t, std::linalg::row_major_t, and std::linalg::upper_triangle_t.
Fixed explanations of pointers/references with storage classes
Explanations of things like:
cdecl> explain static int *p
declare p as static pointer to integer
are now correct.
cdecl-18.4.2
Fixed issue #38: Accumulating newlines in command-line history
A newline should be added to the command-line only after it's been added to the history.
cdecl-18.4.1
readline.h & stdio.h fix
Compensating for the apparent fact that genuine GNU readline.h (wrongly) requires a manual #include <stdio.h>.
cdecl-18.4
C++26
Initial support for C++26 has been added, specifically = delete("reason") is now supported.
However, since C++26 is (at least) 2 years away, the default language for C++ is still C++23.
Placemarker for empty macro argument
Macros that can take a single argument can also accept no arguments since it's interpreted as an argument of a placemarker, e.g.:
cdecl> #define M1(A) [A]
cdecl> expand M1()
M1() => [A]
| A =>
M1() => []
is correct.
cdecl-18.3
no option autocompletion
Since the "no" options are of the form nofoo and not no-foo, if the user types:
cdecl> set no-<tab>
i.e., includes -, it's changed to just "no" so cdecl will still present all the "no" options.
Dynamic __FILE__ & __LINE__ macros
The value of __FILE__ is now the current input file, if any, or stdin. The value of __LINE__ is the line numer within that file, if any.
language option
The lang option has been replaced by language to match the --language command-line option.
Fixed set lang
Giving a value for a language for the set command is now correctly forbidden, e.g.:
cdecl> set c=x
^
7: error: "x": set option "c" takes no value
## whitespace
Fixed incorrect deletion of whitespace when concatenating tokens in some cases.
__VA_ARGS__ as ## argument
__VA_ARGS__ as a ## argument is now correctly not further expanded, e.g.:
cdecl> #define XPASTE(...) x ## __VA_ARGS__
cdecl> expand XPASTE(__LINE__)
...
XPASTE(__LINE__) => x__LINE__
__VA_OPT__ expanding to nothing
When __VA_OPT__ expands to nothing, it needs to expand into a placemarker.
__VA_OPT__ whitespace
Leading & trailing whitespace in __VA_OPT__() tokens is now trimmed, e.g.:
cdecl> #define CALL_QUOTE(x) QUOTE(x)
cdecl> #define QUOTE(X) #X
cdecl> #define TILDAS(...) ~__VA_OPT__( ~ )~
cdecl> expand CALL_QUOTE(TILDAS(x))
...
CALL_QUOTE(~~~) => "~~~"
cdecl-18.2
More permissive types
Unknown names are now always permitted as types in pseudo-English. Hence, the --permissive-types option now only additionally allows keywords in language versions other than the current language as types.
cdecl-18.1
alignas scoped names
Alignments can now have names to denote the number of bytes, e.g.:
c++decl> explain alignas(N) char c
declare c as character aligned as N bytes
where N is presumed to be an integer constant.
_BitInt multi-declarations
Declarations like:
declare x, y as bit precise integer 4
are now correct.
CDECL_TEST=false tests
Fixed these tests.
CDECL_TEST=true & --no-config
Specifying the --no-config option now always works even when testing.
enum, class, struct, & union multi-declarations
Explaining these is now correct, e.g.:
cdecl> explain enum E x, y, f()
declare x, y as enumeration E
declare f as function returning enumeration E
Glob help
Fixed glob help.
Implicit int warnings
In C89, implicit int is now warned about in more cases, e.g.:
cdecl> set c89
cdecl> explain static x
^
9: warning: missing type specifier; "int" assumed
declare x as static integer
K&R C typeless parameters in English
To match gibberish output, K&R C typeless parameters now print as integer in pseudo-English:
cdecl> set c17
cdecl> explain char f(x)
^
16: warning: missing type specifier; "int" assumed
declare f as function (x as integer) returning character
--no-prompt option short option
The short option for --no-prompt has been changed from -p to -P.
New --permissive-types, -p options
Permits either unknown names or keywords in language versions other than the current language as types in pseudo-English. By default, a declaration like:
declare p as pointer to T
where T is an unknown type would result in "unknown type" error. Similarly, a declaration in C like:
declare p as pointer to class
would result in an "unsupported type in C" error even though class would be a valid user-defined type in C. This option permits such declarations.
Permissive types is not the default because always permitting either unknown names or keywords in language versions other than the current language as types can result in confusing errors. For example, if permissive types were the default, then you would get the following in C:
cdecl> declare D as virtual destructor
^
14: warning: "virtual" is a keyword in C++
virtual D;
^
22: syntax error: "destructor": unexpected token ...
Here, virtual, not being a keyword in C and therefore a valid name for a user-defined type, would be taken to be a type name, so cdecl would interpret that to mean you want to declare D as a variable of type virtual -- and cdecl would do so by printing virtual D (but still warning that virtual is a keyword in C++). But then destructor would be unexpectedly encountered and generate an error. (It could easily be the case that you simply forgot to set the current language to C++ instead of C.)
With the default non-permissive behavior, you would instead get:
cdecl> declare D as virtual destructor
^
14: error: "virtual": unsupported keyword in C
which is clearer, but at the cost of not permitting valid declarations that use either unknown names or keywords in language versions other than the current language as types.
show ::FILE
Fixed a crash.
show fixed glob
Now, showing a specific glob (one having no *s in it) like:
c++decl> show ::FILE
will show the definition of FILE even though it's predefined and not the
default of user-defined.
Type name warnings
Defining types that are keywords in other languages are now warned about, e.g.:
cdecl> struct friend
^
8: warning: "friend" is a keyword in C++98
typedef modifiers
Attempting to use modifiers with typedefs is now correctly forbidden, e.g.:
typedef int T
explain unsigned T // error
Unknown names
Now checking for unknown names in pointer-to-member and reference declarations.
cdecl-18.0
Allowing blocks & user-defined literals in multi-declarations
Apple blocks and C++ user-defined literals are now correctly allowed in multi-declarations, e.g.:
int i, a[2], (^b)(char), f(double), operator~(S&), operator""_x(char)
cast & declare command executable name support
Support for the cast & declare command as the executable name has been dropped; only the explain command is still supported. (I didn't realize until now that declare conflicts with the shell built-in.)`
Cast to typedef
Casting to a typedefd type is fixed:
cdecl> typedef int T
cdecl> cast x into T
(T)x
C99 language extensions
Fixed printing of C99 language extention names.
CDECL_DEBUG environment variable
If set to an "affirmative" value (one of 1, t, true, y, or yes, case-insensitive), then cdecl will print its process ID and a "waiting for debugger to attach" message to standard error and wait indefinitely for a debugger to attach.
CDECL_TEST environment variable
If set to an "affirmative" value (one of 1, t, true, y, or yes, case-insensitive), then cdecl be in "testing mode" (see man page for details).
complex & imaginary help
Adding these missing modifiers to the help.
Constructor & pre-C99 function qualifiers
const, volatile, __restrict, final, and override qualifiers are now syntactically allowed on constructors and pre-c99 functions even though they are still semantically illegal to give better error messages.
Digraph & trigraph preprocessor support
Digraphs & trigraphs are now supported by the preprocessor:
#define ML ??/
multiline
%:define QD(X) %:X // same as: #define QD(X) #X
??=define QT(X) ??=X // same as: #define QT(X) #X
Additionally when showing macros in either digraph or trigraph mode, the correct tokens are used:
cdecl> set digraphs
cdecl> show QD
%:define QD(X) %:X
Digraph & trigraph structured binding support
Digraphs & trigraphs are now correctly supported for structured bindings.
--echo-commands & config files
Commands are now also echoed for those in configuration files.
infer-command and constant cast
When infer-command mode is set, spelling out constant now works correctly:
constant cast p into pointer to int
File line number
When reading from a file via -f, now includes the file name and error line number in error messages.
Fixed multi-declaration of functions
A multi-declaration of functions with different signatures has been fixed, e.g.:
cdecl> explain int f(int), g(double)
declare f as function (integer) returning integer
declare g as function (double precision) returning integer
Invalid conf file is now fatal
An error in a conf file is now fatal.
New --lineno, -L option
Specifies an integer to add to all line numbers in error and warning messages as a debugging aid. (See the man page for details.)
show non-existent glob
An error message will now be printed if a glob has no matches.
More permissive scope
Now, scope can be used anywhere in a scoped declaration, i.e., something having the generic scope can have anything nest within it and scope can nest within anything.
C++ std namespace
Whenver "std" is used for a scope, cdecl now automatically makes it a namespace, e.g.:
c++decl> struct std::T
c++decl> explain std::T x
declare x as structure T of namespace std
Using predefined macro names elsewhere
Attempting to use a predefined macro name as an ordinary name now results in an error:
cdecl> explain int __DATE__
^
9: error: "__DATE__" is a predefined macro
cdecl-17.0.1
Fixed returning parameter packs
Functions returning parameter packs is now correctly illegal.