After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 681413 - build: Switch back to using AS_IF for conditionals
build: Switch back to using AS_IF for conditionals
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-08-07 21:47 UTC by Colin Walters
Modified: 2012-08-08 14:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Switch back to using AS_IF for conditionals (2.48 KB, patch)
2012-08-07 21:47 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2012-08-07 21:47:20 UTC
See https://bugzilla.gnome.org/show_bug.cgi?id=674483
Comment 1 Colin Walters 2012-08-07 21:47:22 UTC
Created attachment 220609 [details] [review]
build: Switch back to using AS_IF for conditionals
Comment 2 Matthias Clasen 2012-08-08 01:52:10 UTC
I just can't deal with AS_IF - too much ([]) noise.
When I want to write an if, I'll write 'if'.
Comment 3 Allison Karlitskaya (desrt) 2012-08-08 02:17:09 UTC
The problem with using plain 'if' is that you don't get proper dependency lifting for macros inside the if.  Look at bug 674483 for an example of what happens there.
Comment 4 Allison Karlitskaya (desrt) 2012-08-08 02:19:01 UTC
There's a lot of noise on that other bug, so TL;DR: often macros will pull in one-time initialisation magic (for things like determining certain compiler flags, etc).  m4 can't really tell if you're doing that inside of an 'if' so the first time it happens it assumes that those variables have been defined...  If you were inside of an 'if' and that code didn't run then those variables are unset.

AS_IF() lifts those one-time operations outside of the 'if' so that they always happen.
Comment 5 Colin Walters 2012-08-08 03:00:10 UTC
(In reply to comment #2)
> I just can't deal with AS_IF - too much ([]) noise.
> When I want to write an if, I'll write 'if'.

I hate m4 and shell script just as much (if not more) than you do, but the fact is it solved actual problems.  I didn't just make the changes for fun.
Comment 6 Matthias Clasen 2012-08-08 14:35:22 UTC
Oh, I would never claim that you write m4 for fun :-)
Anyway, I know what AS_IF does.
Comment 7 Matthias Clasen 2012-08-08 14:35:49 UTC
Review of attachment 220609 [details] [review]:

.
Comment 8 Colin Walters 2012-08-08 14:38:31 UTC
Attachment 220609 [details] pushed as ddfcfa6 - build: Switch back to using AS_IF for conditionals