Skip to content

Commit a9a085d

Browse files
committed
Fix object-like shortcut macros
1 parent c049edd commit a9a085d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [unreleased]
88

9+
## [1.5.1] - 2021-10-06
10+
11+
### Fixed
12+
13+
- Previously, shortcuts referring to functional macros were object-like (e.g., `match` or `of`). To avoid nasty compilation errors, now they are function-like too.
14+
915
## [1.5.0] - 2021-08-27
1016

1117
### Added

datatype99.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ SOFTWARE.
3535

3636
#ifndef DATATYPE99_NO_ALIASES
3737

38-
#define datatype datatype99
39-
#define record record99
40-
#define match match99
41-
#define MATCHES MATCHES99
38+
#define datatype(...) datatype99(__VA_ARGS__)
39+
#define record(...) record99(__VA_ARGS__)
40+
#define match(val) match99(val)
41+
#define MATCHES(val, tag) MATCHES99(val, tag)
4242
/// @deprecated Use `MATCHES` instead.
43-
#define matches(val, tag_) \
43+
#define matches(val, tag) \
4444
DATATYPE99_PRIV_PRAGMA_WARN("GCC warning \"`matches` is deprecated, use `MATCHES` instead\"") \
45-
MATCHES(val, tag_)
46-
#define ifLet ifLet99
47-
#define of of99
48-
#define otherwise otherwise99
45+
MATCHES(val, tag)
46+
#define ifLet(val, tag, ...) ifLet99(val, tag, __VA_ARGS__)
47+
#define of(...) of99(__VA_ARGS__)
48+
#define otherwise otherwise99
4949

5050
#define UnitT UnitT99
5151
#define unit_v unit_v99
@@ -284,10 +284,10 @@ static const UnitT99 unit_v99 = '\0';
284284
#define MATCHES99(val, tag_) ((val).tag == tag_##Tag)
285285

286286
/// @deprecated Use `MATCHES99` instead.
287-
#define matches99(val, tag_) \
287+
#define matches99(val, tag) \
288288
DATATYPE99_PRIV_PRAGMA_WARN( \
289289
"GCC warning \"`matches99` is deprecated, use `MATCHES99` instead\"") \
290-
MATCHES99(val, tag_)
290+
MATCHES99(val, tag)
291291

292292
// } (Pattern matching)
293293

0 commit comments

Comments
 (0)