Releases: paul-j-lucas/cdecl
cdecl-11.13
Aligned enum
, struct
, and union
in C
Alignment of enum
, struct
, and union
is now correctly forbidden in C.
alignas
& _Alignas
These keywords are now additionally allowed instead of aligned [as|to]
in pseudo-English.
Auto-completion of cdecl keywords
Cdecl keywords are now not auto-completable when explaining gibberish.
Auto-completion tweaks
new
is now auto-completable; variadic
is now autocompletable only in C89 and later. The following are now not autocompletable: co_await
, co_return
, co_yield
, concept
, decltype
, and requires
.
restrict
of typedef
restrict
is now correctly allowed on typedef
s of pointer:
cdecl> typdef int *pint
cdecl> explain restrict pint p
declare p as restricted pint
return
English shorthand
return
is now accepted as a shorthand for returning
in pseudo-English.
English new-style cast synonyms
The C++ keywords const_cast
, dynamic_cast
, reinterpret_cast
, and static_cast
are now synonyms for their respective two-word counterparts in pseudo-English.
Fixed core dump for --debug
/-d
for operator
Fixed a core dump when using the --debug
/-d
option for an operator.
Fixed function returning function parameter crash
A crash for:
explain void f( int()() )
(which is illegal) has been fixed.
cdecl-11.12
noexcept
for function parameters
noexcept
is now correctly allowed for pointers to function parameter arguments:
c++decl> explain void g( void (*f)() noexcept )
declare g as function (f as pointer to no-exception function returning void) returning void
Dynamic exception specifications
These are now parsed, but either not supported by cdecl through C++14 or no longer supported in C++17.
Ignore leading whitespace for command completion
Previously, if there was any leading whitesplace before a command, that is:
cdecl> dec<TAB>
^
leading whitespace
it wouldn't match: now it does.
Fixed interactive column
The column number printed for error and warning messages while interactive is now correct.
cdecl-11.11
using
with attributes
Now supporting using
with attributes:
c++decl> explain using Int [[maybe_unused]] = int
declare Int as maybe unused type int
Declare types with using
In C++11 and later, types are now declared with using
instead of typedef
by default.
using
declarations
New --no-using
/-u
command-line option and using
set option that control whether types are declared with using
instead of typedef
in C++11 and later:
c++decl> declare pint as type pointer to int
using pint = int*;
c++decl> set nousing
c++decl> declare pint as type pointer to int
typedef int *pint;
More K&R C types
The types caaddr_t
and daddr_t
were added; jmp_buf
was moved from C89.
cdecl-11.10
Pre-C99 implicit int
Added more support for pre-C99 implicit int
:
explain *p // pointer to int
explain *p, i // pointer to int, int
explain *a[4] // array 4 of pointer to int
explain *f() // function returning pointer to int
explain (*p) // pointer to int -- unnecessary ()
const void
function parameters
const
(and volatile
) qualifiers for void
as a function "parameter" (even via a typedef
) are now correctly flagged as an error:
void f1(void); // OK
void f2(const void); // error
typedef void Void;
void f3(Void); // OK
typedef const void CVoid;
void f4(CVoid); // error
Redefinition check in C++
C++ doesn't support tentative definitions, so:
int i, i; // OK in C; error in C++
is always an error in C++ even if the types match.
Restricted pointer to non-object
A restricted pointer to a non-object, e.g., function, is now correctly flagged as an error:
int (*restrict pf)(); // error
cdecl-11.9
Fixed reading from stdin
Fixed reading from stdin when it's not a TTY.
Redefinition check
Names being redefined with a different type in the same declaration are now correctly forbidden:
int i, i; // OK (tentative definition)
int j, *j; // error: different type
Function-like parameter redefinition check
Function-like parameters are now checked for redefinition (more than one parameter having the same name).
More C++ standard types
Added the standard C++ types std::ispanstream
, std::stacktrace_entry
, and std::wispanstream
.
cdecl-11.8
New cdecl keywords
There are now the new pseudo-English keywords of evaluation
(plus eval
as a shorthand), expression
(plus expr
), and initialization
(plus init
) that can optionally be used after constant
(or const
) instead of consteval
, constexpr
, or constinit
, respectively:
c++decl> declare f as constant expression function returning int
constexpr int f();
There are now the new pseudo-English keywords of maybe
, unused
, thread
, local
, as well as discard
, except
, and return
that can be used after no
that can be used instead of maybe_unused
, thread_local
, nodiscard
, noexcept
, and noreturn
.
Fixed reading of stdin
The "no files as arguments" change broke reading of stdin; fixed.
cdecl-11.7
Cdecl keywords
When an unexpected name token is encountered, if said token is a cdecl keyword, it's now mentioned in the error message:
cdecl> declare ptr as pointer to void
^
16: syntax error: "ptr": name expected ("ptr" is a cdecl keyword)
Additionally, cdecl keywords are now also offered in suggestions.
register
arrays
register
arrays are now correctly allowed.
Zero-sized arrays
Zero-sized arrays are now correctly forbidden.
No files as arguments
Command-line arguments were treated as files if they weren't commands. This dubious use-case was a hold-over from the original cdecl and has been removed. (If you want to read a file use -f
.)
cdecl-11.6
C++23 integer literal suffixes
The case-insensitive integer literal suffixes of uz
and zu
for size_t
and z
for ssize_t
are now supported.
C++23 operator[]
Now allowing operator[]
to have zero or more arguments starting in C++23.
Fixed bug with array of function
Given:
cdecl> explain int f[5](double)
declare f as function (double) returning int
cdecl (1) incorrectly elided the array and therefore (2) didn't report the array of function as an error.
typedef
of function
typedef
s of function are now correctly allowed:
typedef int F(void)
cdecl-11.5
Better error/warning locations
Locations for error and warning messages have been improved.
show
error improvement
The show
command now correctly prints all possible commands to define a type when requested to show a type that doesn't exist.
register
warnings
A deprecated warning is now printed for a register
array, enum
, class
, struct
, union
, pointer, pointer to member, reference, and rvalue reference between C++11 and C++14. (Previously, a warning was printed only for built-in types and typedef
s.)
K&R function parameter printed as int
For functions having K&R C typeless parameters, int
is now printed in C89 and later since such parameters are implicitly int
.
show using
before C++11
A show using
before C++11 now prints an error.
Help output
Tweaked help output.
cdecl-11.4
_Atomic(T)
in C++23
Now supporting the _Atomic(T)
macro in C++23.
Fixed pointer to a typedef
of void
Declarations like:
typedef void V
explain V *p
are now fixed.
Allow declarations using unknown scoped type names
Previously, cdecl complained about things like:
cdecl> define S as struct S
cdecl> explain S::T x
^
19: error: "T": unknown name
Now, it just assumes the T
is a type:
declare x as T of structure S
cvr-qualified _Atomic
const
-volatile
-restrict
-qualified _Atomic
types are now correctly forbidden.