Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 22 - Build fails with macro expansion failures for TARGET_ANDROID
Summary: Build fails with macro expansion failures for TARGET_ANDROID
Status: RESOLVED FIXED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: x86_64 Linux
: --- major
Assignee: Johannes Pfau
URL:
Depends on:
Blocks:
 
Reported: 2012-10-26 23:21 CEST by lt.infiltrator
Modified: 2012-11-06 15:46 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lt.infiltrator 2012-10-26 23:21:52 CEST
Error:

In file included from ./tm.h:19:0,
                 from ../../gcc-4.8-20121021/gcc/d/d-spec.c:22:
./options.h:3299:36: error: token "." is not valid in preprocessor expressions
 #define flag_android global_options.x_flag_android
                                    ^
./options.h:4012:26: note: in expansion of macro 'flag_android'
 #define TARGET_ANDROID ((flag_android & OPTION_MASK_ANDROID) != 0)
                          ^
../../gcc-4.8-20121021/gcc/d/d-spec.c:59:36: note: in expansion of macro 'TARGET_ANDROID'
 #if TARGET_WINDOS || TARGET_OSX || TARGET_ANDROID
                                    ^
./options.h:3299:36: error: token "." is not valid in preprocessor expressions
 #define flag_android global_options.x_flag_android
                                    ^
./options.h:4012:26: note: in expansion of macro 'flag_android'
 #define TARGET_ANDROID ((flag_android & OPTION_MASK_ANDROID) != 0)
                          ^
../../gcc-4.8-20121021/gcc/d/d-spec.c:488:22: note: in expansion of macro 'TARGET_ANDROID'
 #if TARGET_LINUX && !TARGET_ANDROID
                      ^


Workaround for me is to just hack d-spec.c and remove those two macros; but that obviously wouldn't work if you're actually targetting android.
Comment 1 Johannes Pfau 2012-10-27 18:16:33 CEST
A recent change in gcc broke this. Workaround: Use an older gcc snapshot. The problem: GCC now defines a TARGET_ANDROID itself which clashes with our TARGET_ANDROID:

-------------------------------------
	* opth-gen.awk (TARGET_* generation): Always generate TARGET_<xxx>
	for Mask options, whether they use Var(...) or not.
-------------------------------------

We can probably use that TARGET_ANDROID macro and throw away our implementation. Can you test if whether it works if you put the calls to TARGET_ANDROID in parens? So in d-spec.c:59:
#if TARGET_WINDOS || TARGET_OSX || (TARGET_ANDROID)

and d-spec.c:488:22:
#if TARGET_LINUX && !(TARGET_ANDROID)

If this does not fix it, it's probably a bug in upstream gcc as the error is in the TARGET_ANDROID macro definition which is part of gcc.
Comment 2 Johannes Pfau 2012-10-27 18:21:03 CEST
Ermm, maybe the gcc TARGET_ANDROID macro expands to a runtime expression. This needs some more work then.
Comment 3 Iain Buclaw 2012-10-27 19:16:20 CEST
(In reply to comment #2)
> Ermm, maybe the gcc TARGET_ANDROID macro expands to a runtime expression. This
> needs some more work then.

That it does. Best thing to do is just give it another name...