Gitweb:
http://git.exim.org/exim.git/commitdiff/b3c261f710276f28ea23bf86dddacdf5fb4612b4
Commit: b3c261f710276f28ea23bf86dddacdf5fb4612b4
Parent: 1ba28e2b955b005ce4825fec792df17f75a8de1e
Author: Phil Pennock <pdp@???>
AuthorDate: Tue Mar 22 06:33:20 2011 -0400
Committer: Phil Pennock <pdp@???>
CommitDate: Tue Mar 22 06:33:20 2011 -0400
Report compiler in -d -bV. Clang compat.
Exim successfully builds with clang, albeit with a number of warnings.
* Our %n usage in printf() calls appears to be correct and safe, AFAICT.
* dummy functions are, unsurprisingly, unused
* Valgrind macros cause vociferous complaints
* Dynamic modules *not* tested
Further clang testing on my part will require an OS update and clang
2.9 to get -rdynamic support.
---
src/src/buildconfig.c | 2 ++
src/src/exim.c | 15 +++++++++++++++
src/src/lookups/whoson.c | 2 +-
src/src/mytypes.h | 2 +-
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c
index c012fb7..5693977 100644
--- a/src/src/buildconfig.c
+++ b/src/src/buildconfig.c
@@ -103,8 +103,10 @@ main(int argc, char **argv)
{
off_t test_off_t = 0;
time_t test_time_t = 0;
+#if ! (__STDC_VERSION__ >= 199901L)
size_t test_size_t = 0;
unsigned long test_ulong_t = 0L;
+#endif
long test_long_t = 0;
FILE *base;
FILE *new;
diff --git a/src/src/exim.c b/src/src/exim.c
index f086a00..3592f30 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -926,6 +926,21 @@ DEBUG(D_any) do {
int i;
+/* clang defines __GNUC__ (at least, for me) so test for it first */
+#if defined(__clang__)
+ fprintf(f, "Compiler: CLang [%s]\n", __clang_version__);
+#elif defined(__GNUC__)
+ fprintf(f, "Compiler: GCC [%s]\n",
+# ifdef __VERSION__
+ __VERSION__
+# else
+ "? unknown version ?"
+# endif
+ );
+#else
+ fprintf(f, "Compiler: <unknown>\n");
+#endif
+
#ifdef AUTH_CYRUS_SASL
auth_cyrus_sasl_version_report(f);
#endif
diff --git a/src/src/lookups/whoson.c b/src/src/lookups/whoson.c
index b4527a9..4a9f01b 100644
--- a/src/src/lookups/whoson.c
+++ b/src/src/lookups/whoson.c
@@ -47,7 +47,7 @@ length = length;
errmsg = errmsg;
do_cache = do_cache;
-switch (wso_query(query, CS buffer, sizeof(buffer)))
+switch (wso_query(CS query, CS buffer, sizeof(buffer)))
{
case 0:
*result = string_copy(buffer); /* IP in database; return name of user */
diff --git a/src/src/mytypes.h b/src/src/mytypes.h
index abf1f53..7a83da8 100644
--- a/src/src/mytypes.h
+++ b/src/src/mytypes.h
@@ -31,7 +31,7 @@ local_scan.h includes it and exim.h includes them both (to get this earlier). */
/* If gcc is being used to compile Exim, we can use its facility for checking
the arguments of printf-like functions. This is done by a macro. */
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
#define PRINTF_FUNCTION(A,B) __attribute__((format(printf,A,B)))
#else
#define PRINTF_FUNCTION(A,B)