diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2015-04-02 13:41:02 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-04-02 13:41:02 +0200 |
commit | dbe7df7571525b2d1ab78c08d2e705c6974ff8b5 (patch) | |
tree | 2df560352ec610cf301eeba4deda74f3c1368174 | |
parent | a3357b892060d6d534bc8d742d42dc78e58e07ce (diff) | |
download | libssh-dbe7df7571525b2d1ab78c08d2e705c6974ff8b5.tar.gz libssh-dbe7df7571525b2d1ab78c08d2e705c6974ff8b5.tar.xz libssh-dbe7df7571525b2d1ab78c08d2e705c6974ff8b5.zip |
cmake: Detect __func__ and __FUNCTION__ during configure step
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | ConfigureChecks.cmake | 15 | ||||
-rw-r--r-- | config.h.cmake | 3 | ||||
-rw-r--r-- | include/libssh/pki_priv.h | 2 | ||||
-rw-r--r-- | include/libssh/priv.h | 8 |
4 files changed, 25 insertions, 3 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 13a0f4dc..650ff4ed 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -215,6 +215,21 @@ int main(void) { return 0; }" HAVE_GCC_NARG_MACRO) +check_c_source_compiles(" +#include <stdio.h> +int main(void) { + printf(\"%s\", __func__); + return 0; +}" HAVE_COMPILER__FUNC__) + +check_c_source_compiles(" +#include <stdio.h> +int main(void) { + printf(\"%s\", __FUNCTION__); + return 0; +}" HAVE_COMPILER__FUNCTION__) + + if (WITH_DEBUG_CRYPTO) set(DEBUG_CRYPTO 1) endif (WITH_DEBUG_CRYPTO) diff --git a/config.h.cmake b/config.h.cmake index 0d30d5df..f74e7825 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -146,6 +146,9 @@ #cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1 #cmakedefine HAVE_GCC_NARG_MACRO 1 +#cmakedefine HAVE_COMPILER__FUNC__ 1 +#cmakedefine HAVE_COMPILER__FUNCTION__ 1 + /* Define to 1 if you want to enable GSSAPI */ #cmakedefine WITH_GSSAPI 1 diff --git a/include/libssh/pki_priv.h b/include/libssh/pki_priv.h index 3a91622c..213e147a 100644 --- a/include/libssh/pki_priv.h +++ b/include/libssh/pki_priv.h @@ -38,7 +38,7 @@ int bcrypt_pbkdf(const char *pass, size_t passlen, const u_int8_t *salt, #define OPENSSH_AUTH_MAGIC "openssh-key-v1" #define ssh_pki_log(...) \ - _ssh_pki_log(__FUNCTION__, __VA_ARGS__) + _ssh_log(SSH_LOG_FUNCTIONS, __func__, __VA_ARGS__) void _ssh_pki_log(const char *function, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 697b45bf..e8b50ba0 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -139,8 +139,12 @@ int gettimeofday(struct timeval *__p, void *__t); #define MAX_BUF_SIZE 4096 #endif -#ifndef __func__ -#define __func__ __FUNCTION__ +#ifndef HAVE_COMPILER__FUNC__ +# ifdef HAVE_COMPILER__FUNCTION__ +# define __func__ __FUNCTION__ +# else +# error "Your system must provide a __func__ macro" +# endif #endif #if defined(HAVE_GCC_THREAD_LOCAL_STORAGE) |