diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-04-11 23:34:42 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-04-11 23:38:00 +0800 |
commit | 5d75c22bf95b7994c1f8619da59d3894907eb0ae (patch) | |
tree | 6b11bd5a3546527f50d7948f87e009edf2905b96 /tools | |
parent | 60b28e75eed154d265ccd480cc151cfba90bddda (diff) | |
download | glibmm-5d75c22bf95b7994c1f8619da59d3894907eb0ae.tar.gz |
tools/m4/compare.m4: Allow decorating comparison operators
This allows one to pass in deocrations for the comparison operators so
that those decorations may be defined as compiler directives to export
symbols in a more fine-grained manner.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/m4/compare.m4 | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/tools/m4/compare.m4 b/tools/m4/compare.m4 index 46afd7ec..d51cc42d 100644 --- a/tools/m4/compare.m4 +++ b/tools/m4/compare.m4 @@ -6,6 +6,7 @@ define(`__OPERATOR_DECL',`dnl * @param rhs The right-hand side * @result The result */ +$2 bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs); ') @@ -27,12 +28,13 @@ dnl define(`_WRAP_EQUAL',`dnl pushdef(`__FUNC_EQUAL__',$1)dnl pushdef(`__UNCONST__',$2)dnl +pushdef(`__FUNC_DECORATOR__',$3)dnl _PUSH(SECTION_HEADER3) __NAMESPACE_BEGIN__ -__OPERATOR_DECL(`==') -__OPERATOR_DECL(`!=') +__OPERATOR_DECL(`==', __FUNC_DECORATOR__) +__OPERATOR_DECL(`!=', __FUNC_DECORATOR__) __NAMESPACE_END__ @@ -42,6 +44,7 @@ __OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0') __OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0') _POP() +popdef(`__FUNC_DECORATOR__')dnl popdef(`__UNCONST__')dnl popdef(`__FUNC_EQUAL__')dnl ')dnl enddef _WRAP_EQUAL @@ -53,16 +56,17 @@ dnl define(`_WRAP_COMPARE',`dnl pushdef(`__FUNC_COMPARE__',$1)dnl pushdef(`__UNCONST__',$2)dnl +pushdef(`__FUNC_DECORATOR__',$3)dnl _PUSH(SECTION_HEADER3) __NAMESPACE_BEGIN__ -__OPERATOR_DECL(`==') -__OPERATOR_DECL(`!=') -__OPERATOR_DECL(`<') -__OPERATOR_DECL(`>') -__OPERATOR_DECL(`<=') -__OPERATOR_DECL(`>=') +__OPERATOR_DECL(`==', __FUNC_DECORATOR__) +__OPERATOR_DECL(`!=', __FUNC_DECORATOR__) +__OPERATOR_DECL(`<', __FUNC_DECORATOR__) +__OPERATOR_DECL(`>', __FUNC_DECORATOR__) +__OPERATOR_DECL(`<=', __FUNC_DECORATOR__) +__OPERATOR_DECL(`>=', __FUNC_DECORATOR__) __NAMESPACE_END__ @@ -76,6 +80,7 @@ __OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0') __OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0') _POP() +popdef(`__FUNC_DECORATOR__')dnl popdef(`__UNCONST__')dnl popdef(`__FUNC_COMPARE__')dnl ')dnl enddef _WRAP_COMPARE @@ -88,16 +93,17 @@ define(`_WRAP_EQUAL_AND_COMPARE',`dnl pushdef(`__FUNC_EQUAL__',$1)dnl pushdef(`__FUNC_COMPARE__',$2)dnl pushdef(`__UNCONST__',$3)dnl +pushdef(`__FUNC_DECORATOR__',$4)dnl _PUSH(SECTION_HEADER3) __NAMESPACE_BEGIN__ -__OPERATOR_DECL(`==') -__OPERATOR_DECL(`!=') -__OPERATOR_DECL(`<') -__OPERATOR_DECL(`>') -__OPERATOR_DECL(`<=') -__OPERATOR_DECL(`>=') +__OPERATOR_DECL(`==', __FUNC_DECORATOR__) +__OPERATOR_DECL(`!=', __FUNC_DECORATOR__) +__OPERATOR_DECL(`<', __FUNC_DECORATOR__) +__OPERATOR_DECL(`>', __FUNC_DECORATOR__) +__OPERATOR_DECL(`<=', __FUNC_DECORATOR__) +__OPERATOR_DECL(`>=', __FUNC_DECORATOR__) __NAMESPACE_END__ @@ -111,6 +117,7 @@ __OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0') __OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0') _POP() +popdef(`__FUNC_DECORATOR__')dnl popdef(`__UNCONST__')dnl popdef(`__FUNC_COMPARE__')dnl popdef(`__FUNC_EQUAL__')dnl |