]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
sysdeps: Move declarations used from C++ to their own header
authorSimon McVittie <smcv@collabora.com>
Tue, 15 Aug 2023 11:50:19 +0000 (12:50 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 15 Aug 2023 12:54:41 +0000 (12:54 +0000)
I want to use <stdatomic.h> in dbus-sysdeps.h, but if we do that, we
won't be able to include that header into C++ code on all compilers.
Move the declarations for new internal Windows-specific functions
introduced in commit 17a23d08
"dbus_threads_init_default, dbus_threads_init: be safe to call at any time"
into their own header.

Signed-off-by: Simon McVittie <smcv@collabora.com>
dbus/CMakeLists.txt
dbus/Makefile.am
dbus/dbus-init-win.cpp
dbus/dbus-init-win.h [new file with mode: 0644]
dbus/dbus-sysdeps-thread-win.c
dbus/dbus-sysdeps-win.h

index cc192ef8455e9a12c7029f605c48cabeb5669ae7..1f545ba6bfbe49fc51cd26bc2fb4f41bb2ea010d 100644 (file)
@@ -185,6 +185,7 @@ if(WIN32)
         dbus-sysdeps-thread-win.c
     )
     set(DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS}
+        dbus-init-win.h
         dbus-sockets-win.h
         dbus-sysdeps-win.h
     )
index fa628ded9bc0570da33e65f9fae30846f6518450..0d38aca20a0ca10317c62bf9e6c152baff4b7c04 100644 (file)
@@ -77,6 +77,7 @@ DBUS_SHARED_arch_sources =                    \
        $(wince_source)                         \
        dbus-backtrace-win.c                    \
        dbus-file-win.c                         \
+       dbus-init-win.h                         \
        dbus-pipe-win.c                         \
        dbus-sockets-win.h                      \
        dbus-sysdeps-win.c                      \
index 3464c88f616cde03387649cd12ca38bdf41a9409..56311d8a602c4c04e4e049e7fc902758754451d6 100644 (file)
@@ -27,7 +27,7 @@
 
 extern "C"
 {
-#include "dbus-sysdeps-win.h"
+#include "dbus-init-win.h"
 }
 
 class DBusInternalInit
diff --git a/dbus/dbus-init-win.h b/dbus/dbus-init-win.h
new file mode 100644 (file)
index 0000000..8a9de8f
--- /dev/null
@@ -0,0 +1,17 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright © 2013 Intel Corporation
+ * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
+ *
+ * Do not include other private headers in this one, particularly
+ * dbus-sysdeps.h: it gets included into C++ code which is not
+ * compatible with our use of <stdatomic.h>.
+ */
+
+#ifndef DBUS_INIT_WIN_H
+#define DBUS_INIT_WIN_H
+
+void        _dbus_threads_windows_init_global (void);
+void        _dbus_threads_windows_ensure_ctor_linked (void);
+
+#endif
index 482623062dcfd2803a0fc6e6316b4845553e1ac7..9f1818f917a9b7b58e1e960a558e5dbf90669386 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <config.h>
+#include "dbus-init-win.h"
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
 #include "dbus-sysdeps-win.h"
index be9cbe15922c267bf510df214048cc64792c5870..f7be21014a0a206ca89b77341ae86070bb049eba 100644 (file)
@@ -87,9 +87,6 @@ _dbus_win_sid_to_name_and_domain (dbus_uid_t uid,
 DBUS_PRIVATE_EXPORT
 dbus_bool_t _dbus_get_install_root (DBusString *str);
 
-void        _dbus_threads_windows_init_global (void);
-void        _dbus_threads_windows_ensure_ctor_linked (void);
-
 DBUS_PRIVATE_EXPORT
 dbus_bool_t _dbus_getsid(char **sid, dbus_pid_t process_id);