Releases: paul-j-lucas/cdecl
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 typedef
s 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 typedef
d 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.
cdecl-17.0
Abbreviated function template parameter packs
Functions with auto
parameters (abbreviated function templates) like:
int f( auto x )
have been supported since cdecl 9.6; this release adds additional support for parameter packs like:
int f( auto ...x )
Added help
option suggestions
Added suggestions to error messages for the help options commands
, english
, and options
, for example:
cdecl> help eglish
^
6: "eglish": no such command or option; did you mean "english"?
Constrained auto
For abbreviated function templates, constrained auto
declarations are now supported:
c++decl> explain C auto x
declare x as concept C
c++decl> explain C auto ...x
declare x as concept C parameter pack
auto
parameters in typedef
s
Use of auto
in typedef
function-like parameters is now correctly reported as an error:
c++decl> typedef int F(auto)
^
15: error: "auto" illegal in type definition
decltype
declarations
Now recognizing decltype
just to say it's not supported.
Glob help
The help text now defines "glob."
GNU --version
Now printing cdecl copyright year, author, license, free software statement, and no warranty statement to conform to the GNU Coding Standards; see https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html.
Structured binding declarations
Structured binding declarations are now supported except that you don't assign them from anything (no =
expression):
c++decl> explain auto [x, y]
declare x, y as structured binding
c++decl> explain auto&& [x, y]
declare x, y as rvalue reference to structured binding
Fixed operator
declaration core dump
An invalid scoped operator name containing a keyword like:
c++decl> explain bool int::operator!()
would dump core; fixed.
Fixed --west-decl=t
for pointer to const pointer
Given:
c++decl --west-decl=t 'declare p as pointer to const pointer to int'
you'd incorrectly get:
int *const *p;
You now correctly get:
int* const* p;
cdecl-16.4.1
Fixed make install DESTDIR=...
Fixed make install
of shell completion functions when setting DESTDIR
on the command-line.
Better error message when expanding __VA_*
macros
Attempting to expand either __VA_ARGS__
or __VA_OPT__
now says that either is valid only in a macro definition.