# stage1: make C\+\+ switch fallthrough an error · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/212e2354b8ab631995b0c25f7cf1d9a3e01fac57)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 212e2354b8ab631995b0c25f7cf1d9a3e01fac57

Requested commit: 212e2354b8ab631995b0c25f7cf1d9a3e01fac57

Commit: 212e2354b8ab631995b0c25f7cf1d9a3e01fac57

Tree: b5d42acd5308378b995bc97b191c8a4efd240a43

Author: Michael Dusan

Committer: Andrew Kelley

## Message

```
stage1: make C++ switch fallthrough an error

Make fallthrough an error when compiler supports it. This requires a new
macro that is defined with such compilers to be used as a statement, at
all fallthrough sites:

    switch (...) {
        case 0:
            ...
            ZIG_FALLTHROUGH;
        case 1:
            ...
            break;
        default:
            ...
            break;
    }

If we ever move to C++17 as minimal requirement, then the macro can be
replaced with `[[fallthrough]];` at statement sites.

```

## Parents

- [0f1f56bb69610ea424ac311db72510b474249095](https://git.cafe/gitcafe/zig/commit/0f1f56bb69610ea424ac311db72510b474249095?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/212e2354b8ab631995b0c25f7cf1d9a3e01fac57?format=markdown)
