Skip to content

Commit ef0a113

Browse files
authored
Merge branch 'libsigcplusplus:master' into zig-pkg
2 parents a64b032 + 793d066 commit ef0a113

25 files changed

+615
-42
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: "CI: autotools: clang 10"
1+
name: "Autotools: clang"
22

33
on: [push]
44

55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v1
@@ -14,14 +14,14 @@ jobs:
1414
# Prevent blocking apt install on a question during configuring of tzdata.
1515
export ENV DEBIAN_FRONTEND=noninteractive
1616
sudo apt update
17-
sudo apt install mm-common clang-10 make docbook-xsl --yes
18-
export CC=clang-10 CXX=clang++-10
17+
sudo apt install mm-common clang make docbook-xsl --yes
18+
export CC=clang CXX=clang++
1919
./autogen.sh --enable-warnings=fatal
2020
make
2121
- name: Test
2222
run: make check
2323
- name: Distcheck
2424
run: |
2525
# distcheck runs configure again so we need to specify CC and CXX again.
26-
export CC=clang-10 CXX=clang++-10
26+
export CC=clang CXX=clang++
2727
make distcheck
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
name: "CI: autotools: gcc 10"
1+
name: "Autotools: gcc"
22

33
on: [push]
44

55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v1
1212
- name: Build
1313
run: |
14+
# Prevent blocking apt install on a question during configuring of tzdata.
15+
export ENV DEBIAN_FRONTEND=noninteractive
1416
sudo apt update
15-
sudo apt install mm-common g++-10 docbook-xsl
16-
export CXX=g++-10
17+
sudo apt install mm-common g++ make docbook-xsl --yes
18+
export CXX=g++
1719
./autogen.sh --enable-warnings=fatal
1820
make
1921
- name: Test
2022
run: make check
2123
- name: Distcheck
2224
run: |
2325
# distcheck runs configure again so we need to specify CXX again.
24-
export CXX=g++-10
26+
export CXX=g++
2527
make distcheck

.github/workflows/clang-format-check.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: "CI: Check Code Formatting"
1+
name: "Check Code Formatting"
22

3-
on: [push]
3+
# Triggered manually
4+
on: [workflow_dispatch]
45

56
jobs:
67
build:
@@ -14,5 +15,5 @@ jobs:
1415
# Prevent blocking the install on a question during configuring of tzdata.
1516
export ENV DEBIAN_FRONTEND=noninteractive
1617
sudo apt update
17-
sudo apt install clang-format-12 --yes
18-
clang-format-12 --dry-run --Werror `find . -name "*.h" -or -name "*.cc"`
18+
sudo apt install clang-format --yes
19+
clang-format --dry-run --Werror `find . -name "*.h" -or -name "*.cc"`

.github/workflows/cmake-msvc.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: "CI: cmake: msvc 2019"
1+
name: "CMake: MSVC"
22

3-
on: [push]
3+
# Triggered manually
4+
on: [workflow_dispatch]
45

56
jobs:
67
build:
78

8-
runs-on: windows-2019
9+
runs-on: windows-latest
910

1011
steps:
1112
- uses: actions/checkout@v1

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CI: cmake"
1+
name: "CMake: gcc"
22

33
on: [push]
44

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: "meson: gcc 10"
1+
name: "Meson: clang"
22

33
on: [push]
44

55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v1
@@ -14,11 +14,8 @@ jobs:
1414
# Prevent blocking apt install on a question during configuring of tzdata.
1515
export ENV DEBIAN_FRONTEND=noninteractive
1616
sudo apt update
17-
sudo apt install libxml2-utils docbook5-xml docbook-xsl mm-common g++-10 ninja-build python3-setuptools python3-pip --yes
18-
# Ubuntu 20.04 contains meson 0.53.2, but libsigc++ requires meson >= 0.55.0.
19-
# Install it with pip3 instead of apt.
20-
sudo pip3 install "meson>=0.55.0"
21-
export CXX=g++-10
17+
sudo apt install libxml2-utils docbook5-xml docbook-xsl mm-common clang meson ninja-build python3-setuptools --yes
18+
export CXX=clang++
2219
meson setup -Dwarnings=fatal -Dwarning_level=3 -Dwerror=true _build
2320
cd _build
2421
meson compile
@@ -30,6 +27,6 @@ jobs:
3027
run: |
3128
sudo apt install git --yes
3229
# dist runs setup again so we need to specify CXX again.
33-
export CXX=g++-10
30+
export CXX=clang++
3431
cd _build
3532
meson dist
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: "meson: clang 10"
1+
name: "Meson: gcc"
22

33
on: [push]
44

55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
steps:
1111
- uses: actions/checkout@v1
@@ -14,11 +14,8 @@ jobs:
1414
# Prevent blocking apt install on a question during configuring of tzdata.
1515
export ENV DEBIAN_FRONTEND=noninteractive
1616
sudo apt update
17-
sudo apt install libxml2-utils docbook5-xml docbook-xsl mm-common clang-10 ninja-build python3-setuptools python3-pip --yes
18-
# Ubuntu 20.04 contains meson 0.53.2, but libsigc++ requires meson >= 0.55.0.
19-
# Install it with pip3 instead of apt.
20-
sudo pip3 install "meson>=0.55.0"
21-
export CXX=clang++-10
17+
sudo apt install libxml2-utils docbook5-xml docbook-xsl mm-common g++ meson ninja-build python3-setuptools --yes
18+
export CXX=g++
2219
meson setup -Dwarnings=fatal -Dwarning_level=3 -Dwerror=true _build
2320
cd _build
2421
meson compile
@@ -30,6 +27,6 @@ jobs:
3027
run: |
3128
sudo apt install git --yes
3229
# dist runs setup again so we need to specify CXX again.
33-
export CXX=clang++-10
30+
export CXX=g++
3431
cd _build
3532
meson dist

.github/workflows/meson-msvc.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Meson: MSVC"
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: windows-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-python@v4
13+
with:
14+
python-version: '3.x'
15+
- run: pip install meson ninja
16+
17+
- name: Prepare MSVC
18+
uses: bus1/cabuild/action/msdevshell@v1
19+
with:
20+
architecture: x64
21+
22+
- name: Configure
23+
# Don't use warning_level or werror. They are applied also to subprojects.
24+
# 2023-07-28: Why is the documentation not built?
25+
# With the latest fixes in mm-common and libsigc++ it's possible
26+
# to build the reference documentation, but it's error-prone to build
27+
# the manual. AFAIK there are no easily installable docbook5-xml and
28+
# docbook-xsl packages for Windows.
29+
run: meson setup -Dwarnings=fatal -Dmaintainer-mode=false -Dbuild-documentation=false _build
30+
31+
- name: Compile
32+
run: meson compile -C _build
33+
34+
- name: Test
35+
run: meson test -C _build

.github/workflows/publish-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# Copied from https://github.com/libsigcplusplus/libsigcplusplus/actions/new
44
# and changed. Actions -> New workflow -> Pages -> GitHub Pages Jekyll
55

6-
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
6+
name: Publish docs
77

8-
# 2022-12-17: ubuntu-latest = ubuntu-22.04
8+
# 2023-07-28: ubuntu-latest = ubuntu-22.04
99
on:
1010
# Runs on pushes targeting the default branch
1111
push:

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ AS_IF([test "x$enable_benchmark" = xyes],[
7474
])
7575

7676
AC_SUBST(MSVC_STATIC_CXXFLAG, '')
77+
AC_SUBST(DOXYGEN_HAVE_DOT, [YES])
78+
AM_SUBST_NOTMAKE(DOXYGEN_HAVE_DOT)
7779

7880
AC_CONFIG_FILES([Makefile
7981
${SIGCXX_MODULE_NAME}.pc:sigc++.pc.in

docs/docs/manual/libsigc_manual.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,19 @@ int main()
258258

259259
<section xml:id="sect-disconnecting">
260260
<info><title>Disconnecting</title></info>
261-
262261
<para>If you decide you no longer want your code to be called whenever a signal is
263262
emitted, you must remember the return value of <literal remap="tt">connect()</literal>, which we've been
264263
ignoring until now.</para>
265264

266265
<para><literal remap="tt">connect()</literal> returns a <literal remap="tt">sigc::connection</literal> object, which has a <literal remap="tt">disconnect()</literal> member method. This does just what you think it does.</para>
267266

267+
<para>Also, sigc++ 3.6 adds <literal remap="tt">sigc::scoped_connection</literal>.
268+
A scoped connection can be constructed or assigned from a normal/unscoped <literal remap="tt">sigc::connection</literal>,
269+
whereupon it effectively takes ownership of the connection, and will automatically <literal remap="tt">disconnect()</literal>
270+
it when the <literal remap="tt">sigc::scoped_connection</literal> is destroyed (goes out of scope) or reassigned.
271+
This lets you tie whether a slot is called to the lifetime of a scoped connection object, e.g. as a class member,
272+
instead of having to manually disconnect. Scoped connections can be put in containers, or made ref-counted via <literal remap="tt">std::shared_ptr</literal>.
273+
See the <literal remap="tt">sigc::scoped_connection</literal> class documentation for examples.</para>
268274
</section>
269275
</chapter>
270276

@@ -431,7 +437,6 @@ asignal.connect( sigc::retype( sigc::ptr_fun(&amp;dostuff) ) );
431437

432438
<chapter xml:id="chapter-reference">
433439
<info><title>Reference</title></info>
434-
435-
<para>See the reference documentation <link xlink:href="http://library.gnome.org/devel/libsigc++/unstable/">online</link></para>
440+
<para>See the reference documentation <link xlink:href="https://libsigcplusplus.github.io/libsigcplusplus/reference/html/">online</link></para>
436441
</chapter>
437442
</book>

docs/docs/reference/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ EXTERNAL_PAGES = YES
296296
#---------------------------------------------------------------------------
297297
DIA_PATH =
298298
HIDE_UNDOC_RELATIONS = NO
299-
HAVE_DOT = YES
299+
HAVE_DOT = @DOXYGEN_HAVE_DOT@
300300
DOT_NUM_THREADS = 0
301301
DOT_FONTNAME = Sans
302302
DOT_FONTSIZE = 10

docs/docs/reference/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Input: project_build_root, project_source_root, sigcxx_pcname,
44
# sigcxx_api_version, build_documentation, source_h_files,
55
# hg_ccg_basenames, install_datadir, python3, doc_reference,
6-
# can_add_dist_script
6+
# can_add_dist_script, dot
77
# Output: install_docdir, install_devhelpdir, book_name,
88
# if build_documentation: tag_file
99

@@ -60,6 +60,7 @@ doc_conf_data.set('abs_top_builddir', project_build_root)
6060
doc_conf_data.set('abs_top_srcdir', project_source_root)
6161
doc_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
6262
doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
63+
doc_conf_data.set('DOXYGEN_HAVE_DOT', dot.found() ? 'YES' : 'NO')
6364

6465
doxyfile = configure_file(
6566
input: 'Doxyfile.in',

meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,14 @@ if maintainer_mode and not mm_common_get.found()
134134
endif
135135

136136
doxygen = find_program('doxygen', required: build_documentation)
137-
dot = find_program('dot', required: build_documentation) # Used by Doxygen
137+
dot = find_program('dot', required: false) # Used by Doxygen, if found
138138
xsltproc = find_program('xsltproc', required: build_documentation)
139139

140+
if build_documentation and not dot.found()
141+
message('The \'dot\' command is not found.\n ' + \
142+
'This will affect the look of the inheritance diagrams in the documentation.')
143+
endif
144+
140145
script_dir = project_source_root / 'untracked' / 'build_scripts'
141146
doc_reference = script_dir / 'doc-reference.py'
142147
dist_changelog = script_dir / 'dist-changelog.py'

sigc++/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
set (SOURCE_FILES
1818
connection.cc
19+
scoped_connection.cc
1920
signal_base.cc
2021
trackable.cc
2122
functors/slot_base.cc

sigc++/connection.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717
*
1818
*/
19+
1920
#ifndef SIGC_CONNECTION_HPP
2021
#define SIGC_CONNECTION_HPP
22+
2123
#include <sigc++config.h>
2224
#include <sigc++/functors/slot_base.h>
2325
#include <sigc++/weak_raw_ptr.h>
@@ -30,13 +32,20 @@ namespace sigc
3032
* This may be used to disconnect the referred slot at any time (disconnect()).
3133
* @ref sigc::signal_with_accumulator::connect() "sigc::signal::connect()"
3234
* returns a %sigc::connection.
35+
*
3336
* @code
3437
* sigc::connection conn = sig.connect(sigc::mem_fun(a, &A::foo));
3538
* @endcode
39+
*
3640
* If the slot has already been destroyed, disconnect() does nothing. empty() or
3741
* operator bool() can be used to test whether the connection is
3842
* still active. The connection can be blocked (block(), unblock()).
3943
*
44+
* sigc::connection doesnʼt disconnect the slot automatically upon destruction.
45+
* You do not need to keep the sigc::connection object to retain the connection
46+
* of the slot to the signal. See also @ref sigc::scoped_connection, which does
47+
* disconnect automatically when the connection object is destroyed or replaced.
48+
*
4049
* @ingroup signal
4150
*/
4251
struct SIGC_API connection

sigc++/filelist.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ sigc_public_h = \
2424
member_method_trait.h \
2525
reference_wrapper.h \
2626
retype_return.h \
27+
scoped_connection.h \
2728
signal.h \
2829
signal_base.h \
2930
slot.h \
@@ -58,6 +59,7 @@ sigc_public_h = \
5859
functors/slot_base.h
5960

6061
sigc_sources_cc = \
62+
scoped_connection.cc \
6163
signal_base.cc \
6264
trackable.cc \
6365
connection.cc \

sigc++/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
source_cc_files = [
1010
'connection.cc',
11+
'scoped_connection.cc',
1112
'signal_base.cc',
1213
'trackable.cc',
1314
'functors' / 'slot_base.cc',
@@ -21,6 +22,7 @@ sigc_h_files = [
2122
'member_method_trait.h',
2223
'reference_wrapper.h',
2324
'retype_return.h',
25+
'scoped_connection.h',
2426
'signal.h',
2527
'signal_base.h',
2628
'slot.h',

0 commit comments

Comments
 (0)