Does not build if not having CXXFLAGS `-std=gnu++14` on Darwin
spice 0.15.0 does not build if not setting -std=gnu++14 for Clang, compiler is complaining errors in server/utils.hpp
In file included from ../server/red-pipe-item.h:27:
../server/utils.hpp:64:20: error: expected ';' at end of declaration list
T* operator->() noexcept
^
;
../server/utils.hpp:78:37: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
unique_link(const unique_link&)=delete;
^
../server/utils.hpp:79:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
void operator=(const unique_link&)=delete;
^
../server/utils.hpp:54:20: error: member initializer 'p' does not name a non-static data member or base class
unique_link(): p(new T())
^~~~~~~~~~
../server/utils.hpp:57:26: error: member initializer 'p' does not name a non-static data member or base class
unique_link(T* ptr): p(ptr)
^~~~~~
../server/utils.hpp:62:16: error: use of undeclared identifier 'p'
delete p;
^
../server/utils.hpp:100:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using glib_unique_ptr = std::unique_ptr<T, GLibDeleter<T>>;
^
../server/utils.hpp:100:57: error: a space is required between consecutive right angle brackets (use '> >')
using glib_unique_ptr = std::unique_ptr<T, GLibDeleter<T>>;
^~
> >
../server/utils.hpp:108:1: error: unknown type name 'constexpr'
constexpr size_t size(const T (&array)[N]) noexcept
^
../server/utils.hpp:108:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr size_t size(const T (&array)[N]) noexcept
^
../server/utils.hpp:108:17: error: expected ';' at end of declaration
constexpr size_t size(const T (&array)[N]) noexcept
^
;
../server/utils.hpp:108:29: error: unknown type name 'T'
constexpr size_t size(const T (&array)[N]) noexcept
^
../server/utils.hpp:108:40: error: use of undeclared identifier 'N'
constexpr size_t size(const T (&array)[N]) noexcept
^
../server/utils.hpp:108:44: error: expected function body after function declarator
constexpr size_t size(const T (&array)[N]) noexcept
^
../server/utils.hpp:138:14: error: no template named 'weak_ptr'; did you mean 'std::weak_ptr'?
friend class weak_ptr<T>;
^~~~~~~~
std::weak_ptr
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:4276:59: note: 'std::weak_ptr' declared here
class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr
No much warnings if build with GCC, and warns a lot if build with clang -std=gnu++14
Warnings while compiling by GCC:
In file included from ../subprojects/spice-common/tests/test-ssl-verify.c:17:
../subprojects/spice-common/common/ssl_verify.c: In function 'verify_pubkey':
../subprojects/spice-common/common/ssl_verify.c:75:5: warning: 'EVP_PKEY_cmp' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
75 | ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey);
| ^~~
In file included from ../subprojects/spice-common/common/ssl_verify.h:32,
from ../subprojects/spice-common/common/ssl_verify.c:22,
from ../subprojects/spice-common/tests/test-ssl-verify.c:17:
/opt/homebrew/Cellar/openssl@3/3.0.2/include/openssl/evp.h:1418:5: note: declared here
1418 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
| ^~~~~~~~~~~~
[20/169] Generating client_demarshallers with a custom command
Wrote subprojects/spice-common/common/generated_messages.h
Wrote subprojects/spice-common/common/generated_client_demarshallers.c
[24/169] Generating server_demarshallers with a custom command
Wrote subprojects/spice-common/common/generated_server_demarshallers.c
[25/169] Generating server_marshallers with a custom command
Wrote subprojects/spice-common/common/generated_server_marshallers.c
Wrote subprojects/spice-common/common/generated_server_marshallers.h
[97/169] Compiling C object server/libspice-server.1.dylib.p/gstreamer-encoder.c.o
../server/gstreamer-encoder.c: In function 'create_pipeline':
../server/gstreamer-encoder.c:994:5: warning: braces around scalar initializer
994 | GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample, {NULL}};
| ^~~~~~~~~~~~~~~~~~~
../server/gstreamer-encoder.c:994:5: note: (near initialization for 'appsink_cbs.new_event')
../server/gstreamer-encoder.c:994:5: warning: missing initializer for field '_gst_reserved' of 'GstAppSinkCallbacks' [-Wmissing-field-initializers]
In file included from ../server/gstreamer-encoder.c:26:
/opt/homebrew/Cellar/gst-plugins-base/1.20.1/include/gstreamer-1.0/gst/app/gstappsink.h:81:16: note: '_gst_reserved' declared here
81 | gpointer _gst_reserved[GST_PADDING - 1];
| ^~~~~~~~~~~~~
Warnings while compiling by Clang -std=gnu++14:
In file included from ../subprojects/spice-common/common/messages.h:63:
subprojects/spice-common/common/generated_messages.h:28:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct SpiceMsgEmpty {
^
subprojects/spice-common/common/generated_messages.h:32:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct SpiceMsgData {
^
subprojects/spice-common/common/generated_messages.h:209:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct SpiceMsgcDisplayGlDrawDone {
^
In file included from ../server/reds.cpp:57:
In file included from ../server/reds.h:27:
In file included from ../server/char-device.h:23:
In file included from ../server/red-channel.h:33:
../server/stat.h:29:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct {
^
../server/stat.h:36:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct {
^
../server/stat.h:96:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct {
^
../server/stat.h:110:9: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
typedef struct {
^
In file included from ../server/reds.cpp:57:
In file included from ../server/reds.h:27:
In file included from ../server/char-device.h:23:
../server/red-channel.h:56:1: warning: 'RedChannel' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
struct RedChannel: public red::shared_ptr_counted
^
../server/red-channel.h:39:1: note: did you mean struct here?
class RedChannel;
^~~~~
struct
In file included from ../server/reds.cpp:57:
In file included from ../server/reds.h:27:
../server/char-device.h:107:1: warning: 'RedCharDevice' defined as a class here but previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
class RedCharDevice: public red::shared_ptr_counted_weak
^
../server/char-device.h:29:1: note: did you mean class here?
struct RedCharDevice;
^~~~~~
class
../server/spice-wrapped.h:31:1: note: did you mean class here?
struct RedCharDevice;
^~~~~~
class
In file included from ../server/reds.cpp:57:
In file included from ../server/reds.h:31:
In file included from ../server/main-dispatcher.h:23:
../server/dispatcher.h:55:1: warning: 'Dispatcher' defined as a class here but previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
class Dispatcher: public red::shared_ptr_counted
^
../server/dispatcher.h:29:1: note: did you mean class here?
struct Dispatcher;
^~~~~~
class
../server/red-channel.h:44:1: note: did you mean class here?
struct Dispatcher;
^~~~~~
class
Using compilers
TorrekiedeMacBook-Pro:build torrekie$ g++-11 -v
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.2.0_3/libexec/gcc/aarch64-apple-darwin20/11/lto-wrapper
Target: aarch64-apple-darwin20
Configured with: ../configure --prefix=/opt/homebrew/Cellar/gcc/11.2.0_3 --libdir=/opt/homebrew/Cellar/gcc/11.2.0_3/lib/gcc/11 --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0_3' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin20 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)
TorrekiedeMacBook-Pro:build torrekie$ c++ -v
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin