Skip to content

Conversation

@oldnewthing
Copy link
Member

@oldnewthing oldnewthing commented Jul 31, 2020

Instead of having everybody just whack state variables (which results in a rats nest of "I don't know what state I'm in any more"), use RAII types to scope the state changes.

The changes for abi_types exactly match the previous behavior, except that abi_types is now false during the generation of write_forward for forward declarations of types from other namespaces, when it used to be true. Fortunately, it doesn't seem to matter, since those forward types don't appear to be affected by the setting of abi_types.

Cannot use RAII types for the file guards because we generate the bottom half of the header file before the top half.

The state of param_names in component_writers.h is still somewhat unclear, so I left that part alone.

Verified that all generated header files (both by build_projection.cmd and Generated Files\*.h) are identical both before and after this change, even with a private hacked pair of builds that assumed all types supported FastABI (which lights up new code paths).

Aside from the param_names issue, this fixes #516

Instead of having everybody just whack state variables
(which results in a rats nest of "I don't know what state
I'm in any more"), use RAII types to scope the state changes.

The changes for `abi_types` exactly match the previous
behavior, except that `abi_types` is now `false` during
the generation of `write_forward` for forward declarations
of types from other namespaces, when it used to be `true`.
Fortunately, it doesn't seem to matter, since those forward
types don't appear to be affected by the setting of `abi_types`.

Cannot use RAII types for the file guards because we
generate the bottom half of the header file before
the top half.

The state of `param_names` in `component_writers.h` is
still somewhat unclear, so I left that part alone.

Verified that all generated header files (both by
`build_projection.h` and `Generated Files\*.h`) are
identical both before and after this change,
even with a private hacked pair of builds that assumed all
types supported FastABI (which lights up new code paths).
@kennykerr kennykerr merged commit e5e1eaa into microsoft:master Aug 1, 2020
@oldnewthing oldnewthing deleted the wrapper branch August 1, 2020 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code gen is not always reliable due to async_types

2 participants