Skip to content

Commit

Permalink
Remove constructor-less struct-initialization with initializer lists,…
Browse files Browse the repository at this point in the history
… which

doesn't work yet in C++11. As a result, we're now fully compatible with C++11.

PiperOrigin-RevId: 293195058
  • Loading branch information
hzeller committed Feb 4, 2020
1 parent 651eebf commit ca3fce4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Toplevel build-file for Verible libraries and tools.
# To compile the tools, invoke
# bazel build --cxxopt='-std=c++17' ...
# bazel build ...
# Run tests with
# bazel test --cxxopt='-std=c++17' ...
# bazel test ...

licenses(["notice"]) # Apache 2.0

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ languages.

Verible's code base is written in C++.

To build, you need the [bazel] build system and a C++17 compatible compiler
To build, you need the [bazel] build system and a C++11 compatible compiler
(e.g. >= g++-7; Using clang currently fails to compile the m4 dependency).

```bash
# Build all tools and libraries
bazel build --cxxopt='-std=c++17' //...
bazel build //...
```

### Test
Expand All @@ -35,7 +35,7 @@ To run the tests in [bazel]:

```bash
# Run all tests
bazel test --cxxopt='-std=c++17' //...
bazel test //...
```

You can access the generated artifacts under `bazel-bin/`. For instance the
Expand Down
8 changes: 6 additions & 2 deletions common/text/macro_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ struct DefaultTokenInfo : public TokenInfo {

// Macro formal parameter specification: name with optional default.
struct MacroParameterInfo {
MacroParameterInfo(const TokenInfo& n = TokenInfo::EOFToken(),
const TokenInfo& d = TokenInfo::EOFToken())
: name(n), default_value(d) {}

// Name of macro parameter.
TokenInfo name = TokenInfo::EOFToken();
TokenInfo name;

// Macro parameters may have default values. [Verilog]
TokenInfo default_value = TokenInfo::EOFToken();
TokenInfo default_value;

bool HasDefaultText() const { return !default_value.text.empty(); }
};
Expand Down
2 changes: 2 additions & 0 deletions common/util/vector_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ std::ostream& operator<<(std::ostream& stream, const VectorTree<T>& node) {
// traversal.
template <typename LT, typename RT>
struct VectorTreeNodePair {
VectorTreeNodePair() {}
VectorTreeNodePair(const LT* l, const RT* r) : left(l), right(r) {}
const LT* left = nullptr;
const RT* right = nullptr;
};
Expand Down
3 changes: 3 additions & 0 deletions verilog/formatting/token_annotator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ namespace {
// We do not want to compare break penalties, because that would be too
// change-detector-y.
struct ExpectedInterTokenInfo {
constexpr ExpectedInterTokenInfo(int spaces, const SpacingOptions& bd)
: spaces_required(spaces), break_decision(bd) {}

int spaces_required = 0;
SpacingOptions break_decision = SpacingOptions::Undecided;

Expand Down

0 comments on commit ca3fce4

Please sign in to comment.