diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-03-13 00:25:36 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-03-13 00:25:36 +0000 |
commit | 0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8 (patch) | |
tree | b65b1a626cb3486ef8a3a3078760e9460223efb0 /src/common/compat.h | |
parent | bd8ffccae7e1bb4030f9ca5e6dd9c8918256de75 (diff) | |
download | tor-0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8.tar.gz tor-0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8.zip |
Instead of listing a set of compilers that prefers __func__ to __FUNCTION__, use autoconf. Also, prefer __func__ in our own code: __func__ is a C99 standard, whereas __FUNCTION__ is not. [Fixes bug 254.]
svn:r6144
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 417b40c136..08b3f76466 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -52,14 +52,29 @@ #define INLINE inline #endif -/* Windows compilers before VC7 don't have __FUNCTION__. */ -#if defined(_MSC_VER) && _MSC_VER < 1300 -#define __FUNCTION__ "???" +/* Try to get a reasonable __func__ substitute in place. */ +#if defined(_MSC_VER) +/* MSVC compilers before VC7 don't have __func__ at all; later ones call it + * __FUNCTION__. */ +#if _MSC_VER < 1300 +#define __func__ "???" +#else +#define __func__ __FUNCTION__ #endif -#if defined(__sgi) && !defined(__GNUC__) && defined(__c99) -#define __FUNCTION__ __func__ +#else +/* For platforms where autoconf works, make sure __func__ is defined + * sanely. */ +#ifndef HAVE_MACRO__func__ +#ifdef HAVE_MACRO__FUNCTION__ +#define __func__ __FUNCTION__ +#elif HAVE_MACRO__FUNC__ +#define __func__ __FUNC__ +#else +#define __func__ "???" #endif +#endif /* ifndef MAVE_MACRO__func__ */ +#endif /* if(not windows) */ /* ===== String compatibility */ #ifdef MS_WINDOWS |