* Parser understands the contextual keyword `stream` to indicate whether
an input or response is a stream of messages.
* Methods like `stream stream()` and `stream stream stream()` are
handled properly (the first is a unary method and the second is a
server stream).
* JSON AST augmented with streaming cardnality.
* C# codegen generates the right code for streaming methods.
* Added streaming and generics C# gRPC examples.
In commit 3221200462, the gRPC golden tests for gbc were accidentally
removed, as they were being done in a function called
`verifyCsCommCodegen`. This commit restores them.
We were always building gbc with GHC optimizations turned on. We can get
faster build times for things like CI if we don't build with optimizations.
To do that, we now pass different stack & gbc options for the various
CMake build types. The MSBuild Compiler.csproj project translates
MSBuild configurations into CMake configurations.
* This fixes broken C# codegen when a service method has attributes.
* Add both C++ and C# unit test to make sure that service and method
attributes are properly generated and accessible.
Fixes https://github.com/Microsoft/bond/issues/617
When a service contains events or parameter-less methods, the generated
code uses `bond::Void` as the request/result type. To serialize
`bond::Void`, bond_reflection.h needs to be included.
The generated service code now includes bond_reflection.h if any service
contains an event or a parameter-less method.
Fixes https://github.com/Microsoft/bond/issues/735
- gbc can only be built with GHC >= 8.0.1
- stack resolver has been updated
- improve error messages
- add a comment about parser ordering to avoid regression
- added python script to compare gbc outputs
Currently C++ enum's name-to-value and value-to-name maps use a `std::map`
and are always constructed, even when not used. This change:
- allows the user to provide custom map type (e.g.
`boost::container::flat_map`)
- lazily constructs the map on first access
- changes the default generated conversion functions to use
`std::unordered_map`
Currently, `boost::assign::map_list_of` is used to initialize C++ metadata
attribute maps. This change makes use of [list initialization][1] available
in C++11 which is more appropriate and removed the dependency on a Boost
header.
[1]: [http://en.cppreference.com/w/cpp/language/list_initialization
Currently, the `--export-attribute` is used to mark all static
`bond::Metadata` fields in a compile-time `Schema` object, including when
the type is a template, which is not correct. This change has `gbc` skip the
attribute in such cases.
Currently, `boost::assign::map_list_of` is used to initialize C++ enum maps.
This change makes use of list initialization[1] available in C++11 which is
more appropriate and avoids an extra dependency on template-heavy Boost
headers.
[1]: http://en.cppreference.com/w/cpp/language/list_initialization
C++ codegen now can use std::scoped_allocator_adaptor for strings and
containers when custom allocator is used and the --scoped-alloc flag is
passed to gbc.
Add the ability to generate copy and move constructors with an allocator
argument. This is behind the gbc flag --alloc-ctors, as the generated copy
and move constructors pass the allocator to the constructors for collection
fields, among others. Not all STL implementations in use by users of Bond
provide these C++11 constructors yet for all collection types. In order to
avoid breaking existing code, these constructors are opt-in.
As of C++11, all the standard containers have a constructor that takes just
an allocator. The expectation is that custom containers will also provide
one.
Since Bond now requires a C++11 compiler, many of the feature checks for
C++11 can be removed. Bond still supports MSVC 2013, which has some
limitations in its C++11 support, so checks for it to enable work-arounds
are still present.
- Now the generated type's default ctor is only compiled when it is
actually used. This permits non-default-constructible allocators to be
used. Ideally, the default ctor would be = default, but that doesn't
work with MSVC 2013, so this workaround is needed.
- An additional defaulted `_bond_vc12_ctor_workaround_` parameter is
used as a workaround for a bug in MSVC 2013 which fails to call the
ctor in some cases.
Closes https://github.com/Microsoft/bond/pull/639
If a service use a generic type like bond.Box<T> with a collection type
argument as a parameter/return type, the generated code was missing an
import of System.Collections.Generic. This has been fixed.
An example, demonstrating how to use bond.Box to wrap scalar service
arguments has been added. This also serves to test the fixed codegen.
A helper method Bond.Box.Create() has been added to enable creation of
Bond.Box<T> instances via type deduction.
Fixes https://github.com/Microsoft/bond/issues/623
For Windows builds, pass linker flags to enable NX and as much of ASLR
as we can.
* We cannot move the base address above 4GiB, as the GHC runtime
libraries are not compiled to support this.
* The linker used by GHC doesn't support keeping reloc information
when emitting PE32+ executables. This will end up limiting the
effectiveness of ASLR, but we're doing what we can.