summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Pennock <pdp@exim.org>2011-03-22 06:33:20 -0400
committerPhil Pennock <pdp@exim.org>2011-03-22 06:33:20 -0400
commitb3c261f710276f28ea23bf86dddacdf5fb4612b4 (patch)
treec004ccb842aa74d03b97193f54185438dcdbb358
parent1ba28e2b955b005ce4825fec792df17f75a8de1e (diff)
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.
-rw-r--r--src/src/buildconfig.c2
-rw-r--r--src/src/exim.c15
-rw-r--r--src/src/lookups/whoson.c2
-rw-r--r--src/src/mytypes.h2
4 files changed, 19 insertions, 2 deletions
diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c
index c012fb7d4..56939770d 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 f086a00e8..3592f30dd 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 b4527a95c..4a9f01bbe 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 abf1f5333..7a83da83f 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)