* [patch,avr]: Minor fixes to some built-in macros
@ 2013-01-14 17:52 Georg-Johann Lay
2013-01-14 18:08 ` Weddington, Eric
0 siblings, 1 reply; 4+ messages in thread
From: Georg-Johann Lay @ 2013-01-14 17:52 UTC (permalink / raw)
To: gcc-patches; +Cc: Denis Chertykov, Eric Weddington
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
This patch does:
1) With 8-bit int, __INT24_MAX__ and __UINT24_MAX__ need a long long suffix.
2) Defines like __FLASH that indicate if address space is available should
be like a predicate, i.e. 1 if the space is available.
Obvious and lightly tested.
Ok?
Johann
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Define __FLASH
etc. to 1 and not to __flash.
Use LL suffix for __INT24_MAX__ with -mint8.
Use ULL suffix for __UINT24_MAX__ with -mint8.
[-- Attachment #2: builtin-def.diff --]
[-- Type: text/x-patch, Size: 1079 bytes --]
Index: config/avr/avr-c.c
===================================================================
--- config/avr/avr-c.c (revision 195151)
+++ config/avr/avr-c.c (working copy)
@@ -169,8 +169,7 @@ avr_cpu_cpp_builtins (struct cpp_reader
const char *name = avr_addrspace[i].name;
char *Name = (char*) alloca (1 + strlen (name));
- cpp_define_formatted (pfile, "%s=%s",
- avr_toupper (Name, name), name);
+ cpp_define (pfile, avr_toupper (Name, name));
}
}
@@ -187,7 +186,9 @@ avr_cpu_cpp_builtins (struct cpp_reader
/* Builtin macros for the __int24 and __uint24 type. */
- cpp_define (pfile, "__INT24_MAX__=8388607L");
+ cpp_define_formatted (pfile, "__INT24_MAX__=8388607%s",
+ INT_TYPE_SIZE == 8 ? "LL" : "L");
cpp_define (pfile, "__INT24_MIN__=(-__INT24_MAX__-1)");
- cpp_define (pfile, "__UINT24_MAX__=16777215UL");
+ cpp_define_formatted (pfile, "__UINT24_MAX__=16777215%s",
+ INT_TYPE_SIZE == 8 ? "ULL" : "UL");
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch,avr]: Minor fixes to some built-in macros
2013-01-14 17:52 [patch,avr]: Minor fixes to some built-in macros Georg-Johann Lay
@ 2013-01-14 18:08 ` Weddington, Eric
2013-01-14 18:15 ` Georg-Johann Lay
0 siblings, 1 reply; 4+ messages in thread
From: Weddington, Eric @ 2013-01-14 18:08 UTC (permalink / raw)
To: Georg-Johann Lay, gcc-patches; +Cc: Denis Chertykov
> -----Original Message-----
> From: Georg-Johann Lay
> Sent: Monday, January 14, 2013 10:52 AM
> To: gcc-patches@gcc.gnu.org
> Cc: Denis Chertykov; Weddington, Eric
> Subject: [patch,avr]: Minor fixes to some built-in macros
>
> This patch does:
>
> 1) With 8-bit int, __INT24_MAX__ and __UINT24_MAX__ need a long long
> suffix.
>
> 2) Defines like __FLASH that indicate if address space is available
> should
> be like a predicate, i.e. 1 if the space is available.
I'm not seeing #2 being done in the patch... Am I missing something?
Eric
> Obvious and lightly tested.
>
> Ok?
>
> Johann
>
>
> * config/avr/avr-c.c (avr_cpu_cpp_builtins): Define __FLASH
> etc. to 1 and not to __flash.
> Use LL suffix for __INT24_MAX__ with -mint8.
> Use ULL suffix for __UINT24_MAX__ with -mint8.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch,avr]: Minor fixes to some built-in macros
2013-01-14 18:08 ` Weddington, Eric
@ 2013-01-14 18:15 ` Georg-Johann Lay
2013-01-14 18:19 ` Weddington, Eric
0 siblings, 1 reply; 4+ messages in thread
From: Georg-Johann Lay @ 2013-01-14 18:15 UTC (permalink / raw)
To: Weddington, Eric; +Cc: gcc-patches, Denis Chertykov
Weddington, Eric wrote:
>>
>> This patch does:
>>
>> 1) With 8-bit int, __INT24_MAX__ and __UINT24_MAX__ need a long long
>> suffix.
>>
>> 2) Defines like __FLASH that indicate if address space is available should
>> be like a predicate, i.e. 1 if the space is available.
>
> I'm not seeing #2 being done in the patch... Am I missing something?
The current "#define __FLASH=__flash" is accomplished by the
cpp_define_formatted with "%s=%s". The new is just a cpp_define for __FLASH,
retrieved by avr_toupper.
Johann
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch,avr]: Minor fixes to some built-in macros
2013-01-14 18:15 ` Georg-Johann Lay
@ 2013-01-14 18:19 ` Weddington, Eric
0 siblings, 0 replies; 4+ messages in thread
From: Weddington, Eric @ 2013-01-14 18:19 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Denis Chertykov
> -----Original Message-----
> From: Georg-Johann Lay
> Sent: Monday, January 14, 2013 11:15 AM
> To: Weddington, Eric
> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov
> Subject: Re: [patch,avr]: Minor fixes to some built-in macros
>
> Weddington, Eric wrote:
> >>
> >> This patch does:
> >>
> >> 1) With 8-bit int, __INT24_MAX__ and __UINT24_MAX__ need a long long
> >> suffix.
> >>
> >> 2) Defines like __FLASH that indicate if address space is available
> should
> >> be like a predicate, i.e. 1 if the space is available.
> >
> > I'm not seeing #2 being done in the patch... Am I missing something?
>
> The current "#define __FLASH=__flash" is accomplished by the
> cpp_define_formatted with "%s=%s". The new is just a cpp_define for
> __FLASH,
> retrieved by avr_toupper.
Thanks for the explanation. Please commit.
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-14 18:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 17:52 [patch,avr]: Minor fixes to some built-in macros Georg-Johann Lay
2013-01-14 18:08 ` Weddington, Eric
2013-01-14 18:15 ` Georg-Johann Lay
2013-01-14 18:19 ` Weddington, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).