attached is a patch to allow cyrus-sasl to build with GCC 4.4. the preprocessor in 4.4 no longer allows code like
using #elif to check if a macro is defined must now be in the form
Created attachment 173300 [details, diff]
The patch may be right, but the comment is misleading if not wrong. GCC 4.4 does allow
with usually the same meaning as GCC 4.3 and earlier. Assuming A is not defined, it evaluates B (after macro expansion) as an expression, and if it is zero, it skips the block, otherwise it doesn't. If B is not a valid expression, the compiler reports an error. If B is defined, but its definition is 0, the block is skipped, no matter which version you're using. The only difference is that when A _is_ defined, the compiler now still checks to see if B is a valid expression. Since in this case the definition of B is and is supposed to be empty, the code was wrong all along, and would have blown up for anyone with other compilers where A wasn't defined. It never meant #elif defined(B).
Created attachment 186525 [details, diff]
Use safe prepocessor rules...
cos its evaluated now too, but this will be safe:
As mentioned in http://bugs.gentoo.org/show_bug.cgi?id=249226#c8
(In reply to comment #3)
> Created an attachment (id=186525) 
> Use safe prepocessor rules...
#elif defined(X) is safe regardless of whether and how B is defined. The first suggested patch was correct.
yes, i misunderstood the problem. #elif arguments are now evaluated even if earlier conditions succeeded, and #elif arguments must be constant expressions.
+ 08 May 2009; Peter Alfredsen <email@example.com>
+ cyrus-sasl-2.1.22-r2.ebuild, +files/cyrus-sasl-2.1.22-gcc44.patch:
+ Fix gcc-4.4 compatibility, bug 248738. Thanks to dirtyepic for the patch.