Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 248738 - dev-libs/cyrus-sasl-2.1.22-r2 patch for GCC 4.4
Summary: dev-libs/cyrus-sasl-2.1.22-r2 patch for GCC 4.4
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-4.4
  Show dependency tree
 
Reported: 2008-11-25 06:01 UTC by Ryan Hill (RETIRED)
Modified: 2009-05-08 00:58 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
cyrus-sasl-2.1.22-gcc44-elif.patch (cyrus-sasl-2.1.22-gcc44-elif.patch,665 bytes, patch)
2008-11-25 06:02 UTC, Ryan Hill (RETIRED)
Details | Diff
Use safe prepocessor rules... (cyrus-sasl-2.1.22-gcc44-elif.patch,1.06 KB, patch)
2009-03-28 11:17 UTC, Sergey Dryabzhinsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill (RETIRED) gentoo-dev 2008-11-25 06:01:59 UTC
attached is a patch to allow cyrus-sasl to build with GCC 4.4.  the preprocessor in 4.4 no longer allows code like

 #ifdef FOO
 ...
 #elif BAR
 ...
 #endif

using #elif to check if a macro is defined must now be in the form

 #elif defined(BAR)
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2008-11-25 06:02:49 UTC
Created attachment 173300 [details, diff]
cyrus-sasl-2.1.22-gcc44-elif.patch
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2008-11-30 09:48:04 UTC
The patch may be right, but the comment is misleading if not wrong. GCC 4.4 does allow

#ifdef A
#elif B
#endif

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).
Comment 3 Sergey Dryabzhinsky 2009-03-28 11:17:08 UTC
Created attachment 186525 [details, diff]
Use safe prepocessor rules...

Don't use:

...
 #elif defined(B) 
...

cos its evaluated now too, but this will be safe:

...
#else
 #ifdef B
...

As mentioned in http://bugs.gentoo.org/show_bug.cgi?id=249226#c8
Comment 4 Harald van Dijk (RETIRED) gentoo-dev 2009-03-28 13:23:57 UTC
(In reply to comment #3)
> Created an attachment (id=186525) [edit]
> Use safe prepocessor rules...

#elif defined(X) is safe regardless of whether and how B is defined. The first suggested patch was correct.
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2009-03-29 00:00:59 UTC
yes, i misunderstood the problem.  #elif arguments are now evaluated even if earlier conditions succeeded, and #elif arguments must be constant expressions.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36320
Comment 6 Peter Alfredsen (RETIRED) gentoo-dev 2009-05-08 00:58:37 UTC
+  08 May 2009; Peter Alfredsen <loki_val@gentoo.org>
+  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.
+