coap_{notls,openssl,tinydtls}.c: quiet 'unused function' warning

Depending on the TLS library being used (which may be none), the
code that depends on other TLS libraries is not compiled. Because
some compilers are not happy compiling empty modules, each of these
files contains an empty static inline function dummy() that gets
compiled instead. As clang happens to emit a warning for this
function when -Wunused-function is set, this change introduces
a GCC pragma (sic!) to suppress this warning for the dummy function.
This commit is contained in:
Olaf Bergmann committed 2018-05-31 11:12:01 +02:00
1 parent 8e446e732a
commit 26d5cf784a
3 files changed
+18 -3

No files matched your search

+6 -1
View File
@@ -165,8 +165,13 @@ ssize_t coap_tls_read(coap_session_t *session UNUSED,
#else /* !HAVE_LIBTINYDTLS && !HAVE_OPENSSL */
/* make compilers happy that do not like empty modules */
/* Make compilers happy that do not like empty modules. As this
* function is never used, we ignore -Wunused-function temporarily.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline void dummy(void) {
}
#pragma GCC diagnostic pop
#endif /* !HAVE_LIBTINYDTLS && !HAVE_OPENSSL */
+6 -1
View File
@@ -1174,8 +1174,13 @@ ssize_t coap_tls_read(coap_session_t *session,
#else /* !HAVE_OPENSSL */
/* make compilers happy that do not like empty modules */
/* Make compilers happy that do not like empty modules. As this
* function is never used, we ignore -Wunused-function temporarily.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline void dummy(void) {
}
#pragma GCC diagnostic pop
#endif /* HAVE_OPENSSL */
+6 -1
View File
@@ -503,8 +503,13 @@ ssize_t coap_tls_read(coap_session_t *session UNUSED,
#else /* !HAVE_LIBTINYDTLS */
/* make compilers happy that do not like empty modules */
/* Make compilers happy that do not like empty modules. As this
* function is never used, we ignore -Wunused-function temporarily.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline void dummy(void) {
}
#pragma GCC diagnostic pop
#endif /* HAVE_LIBTINYDTLS */