Skip to content

Commit cd68de2

Browse files
committed
Fix build with -Dbuild-deprecated-api=false
Fixes #82
1 parent b995711 commit cd68de2

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

examples/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ foreach ex : examples
2020
endforeach
2121

2222
exe_file = executable(ex_name, ex_sources,
23-
cpp_args: '-DSIGCXX_DISABLE_DEPRECATED',
23+
cpp_args: '-DSIGCXX_DISABLE_DEPRECATED=1',
2424
dependencies: sigcxx_own_dep,
2525
implicit_include_directories: false,
2626
build_by_default: build_examples

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
202202
pkg_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
203203

204204
if not build_deprecated_api
205-
pkg_conf_data.set('SIGCXX_DISABLE_DEPRECATED', true)
205+
pkg_conf_data.set('SIGCXX_DISABLE_DEPRECATED', 1)
206206
endif
207207
pkg_conf_data.set('SIGCXX_MAJOR_VERSION', sigcxx_major_version)
208208
pkg_conf_data.set('SIGCXX_MINOR_VERSION', sigcxx_minor_version)

tests/test_disconnect.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
* Assigned to public domain. Use as you wish without restriction.
33
*/
44

5+
// sigc::signal<>.slots() is deprecated, but let's keep the test if possible.
6+
// If libsigc++ is configured with -Dbuild-deprecated-api=false
7+
// (--disable-deprecated-api), SIGCXX_DISABLE_DEPRECATED is defined in
8+
// sigc++config.h. An undef at the start of this file has no effect.
9+
#undef SIGCXX_DISABLE_DEPRECATED
10+
511
#include "testutilities.h"
612
#include <sigc++/trackable.h>
713
#include <sigc++/signal.h>
@@ -103,11 +109,20 @@ int main(int argc, char* argv[])
103109
util->check_result(result_stream, "sig is connected to foo, bar (size=2): foo(2) bar(2) ");
104110

105111
A a; // iterators stay valid after further connections.
112+
#ifndef SIGCXX_DISABLE_DEPRECATED
106113
cona = sig.slots().insert(conbar, sigc::mem_fun1(a, &A::foo));
114+
#else
115+
cona = sig.connect(sigc::mem_fun1(a, &A::foo));
116+
#endif
107117
result_stream << "sig is connected to foo, A::foo, bar (size=" << sig.size() << "): ";
108118
sig(3);
119+
#ifndef SIGCXX_DISABLE_DEPRECATED
109120
util->check_result(result_stream,
110121
"sig is connected to foo, A::foo, bar (size=3): foo(3) A::foo(3) bar(3) ");
122+
#else
123+
util->check_result(result_stream,
124+
"sig is connected to foo, A::foo, bar (size=3): foo(3) bar(3) A::foo(3) ");
125+
#endif
111126

112127
conbar->disconnect(); // manual disconnection
113128
result_stream << "sig is connected to foo, A::foo (size=" << sig.size() << "): ";

0 commit comments

Comments
 (0)