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.
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");
 }

Reply via email to