devel/cdecl: update to 18.1
ChangeLog:
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.