Schedule.cc currently makes use of a custom slab allocator by having
some structs specify a custom operator new/operator delete that call
into the slab allocator. However, this setup currently relies on C++ UB,
namely that writes that happen in operator delete are persisted
afterwards. The slab allocator inside the free_slab function uses the
memory of the object being freed to store allocator metadata, which is
not allowed given the rules around operator delete.
This patch changes the internal storage of slab_allocator to a struct
rather than a union so we can only return the actual storage when
allocating an object and there is a header for each object that the
allocator can use for metadata without writes to it being UB.
The new option allows parameter, net and events to be used before
declaration. With variants
-gno-strict-net-declaration for nets and events,
-gno-strict-parameter-declaration for parameters.
With `-ggno-strict-parameter-declaration` a warning is issued for
parameter use before declaration. This warning suppressed with
the new class `-Wno-declaration-after-use`, instead of `-Wno-anachronisms`.
The standards requires that parameters must be declared
before they are used. Using -gno-strict-parameter-declaration
will allow using a parameter before declaration, e.g., in a port
declaration, with the parameter declared in the body of the
module. Prior to version 13 this was allowed, so there is a large body
of existing code depending on the pre version 13 behaviour.
The vvp/ivl_dlfcn.h and cadpli/ivl_dlfcn.h files are essentially the
same, but have diverged a bit over the years. Merge them into a single
shared file at the top level. Use the static prefix for all inline
functins (currently only used in the cadpli version) as that will fix
issue #1301. We now require the compiler to support at least C99, so
can use "inline", not "__inline__".