Closed gabrielschulhof closed 8 years ago
It seems this is a C feature that doesn't have equivalent in C++. If that's the case we could use a macro so that in C++ the replacement would be empty.
@lpereira thoughts on whether C++ has something equivalent?
I think @cmarcelo proposal for macro in the "static N" is the alternative, something like SOL_STATIC_ARRAY_SIZE(n) (I'm okay with other names, but remember to keep the SOL prefix.
As for the first error in buffer, it would be better to have the macro to use GCC type checking expression before doing a cast -- or have the cast explicitly in the call site.
Last but not least, would be nice to have a test that includes all our installed headers and compile with g++ to ensure we're not breaking in future commits.
For the record, @lpereira pointed that lwan (his project) uses a macro as well https://github.com/lpereira/lwan/blob/master/common/lwan.h#L101
@gabrielschulhof a patch was applied for this issue, could you test again with master?
With master as of f3aa5fb82145e6dfc08a9ab58c5aa0c93a1fbe55 I can't get soletta itself to build:
./src/lib/comms/sol-socket-dtls-impl-tinydtls.c: In function ‘sol_socket_dtls_set_handshake_cipher’:
./src/lib/comms/sol-socket-dtls-impl-tinydtls.c:836:64: error: ‘TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256’ undeclared (first use in this function)
[SOL_SOCKET_DTLS_CIPHER_ECDH_ANON_AES128_CBC_SHA256] = TLS_ECDH_anon_WITH_AES_128_CBC_SHA_256,
^
... so, I'll wait for a commit on soletta's master which will allow me to build it, before I can check whether the headers can be included from C++.
@ceolin could you please take a look on this issue and see if we can close it? It seems the case for me
yep, i'll see it.
i've checked that many headers are not buildable with g++. Those headers contains inline code that need to be changed, things like implicit cast:
error: invalid conversion from ‘void ’ to ‘const char*’ [-fpermissive]
I'm going to review our headers to fix this issue.
I've fixed our public headers to build using c++ compiler. It's required c++0x support, so it's necessary -std=gnu++0x
or -std=c++0x
option.
Please check https://github.com/solettaproject/soletta/pull/1219
pullrequest was merged, the problem seems to be solved
When using g++ to compile a file which includes soletta public headers, it dies on code like
The above is only a warning and not an error because I passed
-fpermissive
to g++, but I'd rather pointers were cast than have to add this flag.More importantly, it dies on
for which I cannot think of a flag to pass to g++ to get it to accept the code.