On 2012-05-19 at 08:55 -0700, Todd Lyons wrote:
> Current master builds just fine on my Ubuntu machines (11.04 and 12.04).
> Building RC2 on CentOS 5.x, compiling exim.c is failing with this:
> exim.c: In function ‘show_whats_supported’:
> exim.c:1007: warning: implicit declaration of function ‘STRINGIFY’
> exim.c:1007: error: expected ‘)’ before string constant
> exim.c:1007: warning: format ‘%s’ expects type ‘char *’, but argument 6 has
> type ‘int’
> exim.c:1007: warning: too few arguments for format
> The relevant lines are:
> 1007 fprintf(f, "Library version: PCRE: Compile: %d.%d%s\n"
> 1008 " Runtime: %s\n",
> 1009 PCRE_MAJOR, PCRE_MINOR,
> 1010 /* PRE_PRERELEASE is either defined and empty or a string.
> 1011 * unless its an ancient version of PCRE in which case it
> 1012 * is not defined */
> 1013 #ifdef PCRE_PRERELEASE
> 1014 # define STRINGIFY(x) #x
> 1015 STRINGIFY(PCRE_PRERELEASE) "",
> 1016 # undef STRINGIFY
> 1017 #else
> 1018 "",
> 1019 #endif
> 1020 pcre_version());
>
> It looks fine to me, but the #define for some reason is not occurring. Can
> you spot anything wrong with this?
*sigh* The very first change after the 4.77 release, because of problems
folks had with PCRE_PRERELEASE in that.
There's one mistake in it for sure: "PCRE_PRERELEASE" is being inserted
as a literal string. Doh. I've looked over that output many times and
just assumed I had a prerelease of PCRE installed.
I've rewritten the layout to move the #ifdef outside the function
definition, which *should* have absolutely no impact upon matters, but
maybe it does.
Does the attached patch fix this for you?
-Phil
diff --git a/src/src/exim.c b/src/src/exim.c
index 720d228..af01d40 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -976,20 +976,21 @@ DEBUG(D_any) do {
}
}
+ /* PRE_PRERELEASE is either defined and empty or a bare sequence of
+ characters; unless it's an ancient version of PCRE in which case it
+ is not defined. */
+#ifndef PCRE_PRERELEASE
+#define PCRE_PRERELEASE
+#endif
+#define QUOTE(X) #X
+#define EXPAND_AND_QUOTE(X) QUOTE(X)
fprintf(f, "Library version: PCRE: Compile: %d.%d%s\n"
" Runtime: %s\n",
PCRE_MAJOR, PCRE_MINOR,
- /* PRE_PRERELEASE is either defined and empty or a string.
- * unless its an ancient version of PCRE in which case it
- * is not defined */
-#ifdef PCRE_PRERELEASE
-# define STRINGIFY(x) #x
- STRINGIFY(PCRE_PRERELEASE) "",
-# undef STRINGIFY
-#else
- "",
-#endif
+ EXPAND_AND_QUOTE(PCRE_PRERELEASE) "",
pcre_version());
+#undef QUOTE
+#undef EXPAND_AND_QUOTE
init_lookup_list();
for (i = 0; i < lookup_list_count; i++)