This is the mail archive of the
mailing list for the GCC project.
Re: target attributes, pragmas and preprocessor macros
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: Christian Bruel <christian dot bruel at st dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 18 May 2015 10:46:00 +0100
- Subject: Re: target attributes, pragmas and preprocessor macros
- Authentication-results: sourceware.org; auth=none
- References: <55537136 dot 5030007 at arm dot com> <55598626 dot 2010205 at st dot com> <5559A1F5 dot 7070805 at arm dot com>
On 18/05/15 09:25, Kyrill Tkachov wrote:
On 18/05/15 07:26, Christian Bruel wrote:
On 05/13/2015 05:43 PM, Kyrill Tkachov wrote:
Are target attributes supposed to redefine the preprocessor macros available?
For example, on aarch64 if the file is compiled with floating point support
the __ARM_FEATURE_FMA predefine is available. If the user adds to a function
a target attribute disabling floating point, then is __ARM_FEATURE_FMA supposed
to be undefined in the body of that function?
Looking at some backends, it seems that only #pragmas are supposed to have that effect,
but I just wanted to confirm.
yes they do, But careful, even the "inherited" macros should be redefined...
Implementation question then.
Is TARGET_PRAGMA_PARSE actually called during preprocessing time?
I built an x86_64 toolchain, compiled a file with target pragmas in it,
put a breakpoint on the hook entry and it only triggered later on during parsing.
Same for an aarch64 implementation of target pragmas that I'm working on.
Am I just doing something wrong? Or is there some other place where I should
Actually, scratch that. I got it working, sorry for the noise.
for instance for arm/thumb we can have something like:
#pragma GCC target ("thumb")
#error "__thumb__ is not defined"
#error "__ARM_32BIT_STATE is not defined"
#else /* thumb1 */
#error "__ARM_32BIT_STATE is defined"
#endif /* thumb1 */