Hi,

I patched dovecot-1.1.beta14 to compile under gcc 2.95. __builtin_expect
and __attribute__((malloc)) are only available since gcc 3.0, and
__builtin_types_compatible_p since 3.1.

Also the flexible array members (char a[]) are not available for gcc
2.95. So I replaced them with zero-extent arrays (char a[0]), which
should also work, but that is gcc specific. A general pointer (char* a)
should work as well, I guess.

I have attached a patch that fixes all this. It is for beta13 but also
works on beta14.

BTW.: There is a typo in src/login-common/main.c, it's equivalent, not
equilevant.


Cheers,

Sven

-- 
http://sven.anderson.de    "Believe those who are seeking the truth.
tel:    +49-551-9969285     Doubt those who find it."
mobile: +49-179-4939223                                 (André Gide)
diff -ru dovecot-1.1.beta13/src/lib/macros.h dovecot-1.1.beta13.patched/src/lib/macros.h
--- dovecot-1.1.beta13/src/lib/macros.h	Mon Dec  3 15:27:12 2007
+++ dovecot-1.1.beta13.patched/src/lib/macros.h	Thu Jan 17 15:06:13 2008
@@ -106,7 +106,6 @@
 #  define ATTR_UNUSED __attribute__((unused))
 #  define ATTR_NORETURN __attribute__((noreturn))
 #  define ATTR_CONST __attribute__((const))
-#  define ATTR_MALLOC __attribute__((malloc))
 #else
 #  define ATTR_FORMAT(format_idx, arg_idx)
 #  define ATTR_FORMAT_ARG(arg_idx)
@@ -115,6 +114,10 @@
 #  define ATTR_NORETURN
 #  define ATTR_CONST
 #  define ATTR_UNUSED
+#endif
+#if __GNUC__ > 2
+#  define ATTR_MALLOC __attribute__((malloc))
+#else
 #  define ATTR_MALLOC
 #endif
 #if __GNUC__ > 3
@@ -146,7 +149,7 @@
 	name(__VA_ARGS__, (callback_type *)callback, context)
 #endif
 
-#ifdef __GNUC__
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
 #  define HAVE_TYPEOF
 #  define COMPILE_ERROR_IF_TRUE(condition) \
 	(sizeof(char[1 - 2 * !!(condition)]) - 1)
@@ -168,7 +171,7 @@
 #  define GNUC_PRETTY_FUNCTION ""
 #endif
 
-#ifdef __GNUC__
+#if __GNUC__ > 2
 #  define unlikely(expr) __builtin_expect(!!(expr), 0)
 #  define likely(expr) __builtin_expect(!!(expr), 1)
 #else
diff -ru dovecot-1.1.beta13/src/lib/str-find.c dovecot-1.1.beta13.patched/src/lib/str-find.c
--- dovecot-1.1.beta13/src/lib/str-find.c	Tue Oct 23 16:01:16 2007
+++ dovecot-1.1.beta13.patched/src/lib/str-find.c	Thu Jan 17 14:08:03 2008
@@ -12,7 +12,7 @@
 	unsigned int match_count;
 
 	int badtab[UCHAR_MAX+1];
-	int goodtab[];
+	int goodtab[0];
 };
 
 static void init_badtab(struct str_find_context *ctx)
diff -ru dovecot-1.1.beta13/src/lib-imap/imap-match.c dovecot-1.1.beta13.patched/src/lib-imap/imap-match.c
--- dovecot-1.1.beta13/src/lib-imap/imap-match.c	Sun Dec  9 19:14:27 2007
+++ dovecot-1.1.beta13.patched/src/lib-imap/imap-match.c	Thu Jan 17 14:09:02 2008
@@ -19,7 +19,7 @@
 	struct imap_match_pattern *patterns;
 
 	char sep;
-	char patterns_data[];
+	char patterns_data[0];
 };
 
 struct imap_match_context {

Reply via email to