]> oss.titaniummirror.com Git - nesc.git/blobdiff - src/machine/keil.c
Merge branch 'upstream' (nesc-1.3.2)
[nesc.git] / src / machine / keil.c
index 27b9ef2ab78ee637644f61a4e9346fc1b80b3c78..cd46abacac89a4eeec7ee3be3fef339071aaff8c 100644 (file)
@@ -40,7 +40,12 @@ static int keil_token(const char *token, int len, struct yystype *lvalp)
   struct keilword *keyword = is_keil_word(token, len);
 
   if (keyword)
-    return keyword->token;
+    {
+      lvalp->idtoken.location = last_location();
+      lvalp->idtoken.id = make_cstring(parse_region, token, len);
+      lvalp->idtoken.decl = NULL;
+      return keyword->token;
+    }
 
   return IDENTIFIER;
 }
@@ -52,7 +57,7 @@ declaration keil_special(location loc, cstring keyword, cstring name,
   region r = parse_region;
   /* Build __attribute__((keil_address(address))) */
   word aword = new_word(r, loc, str2cstring(r, "keil_address"));
-  gcc_attribute address_attr = new_gcc_attribute(r, loc, aword, address);
+  target_attribute address_attr = new_target_attribute(r, loc, aword, address);
 
   /* Build a declaration for name */
   declarator d = make_identifier_declarator(loc, name);
@@ -79,7 +84,7 @@ declaration keil_special(location loc, cstring keyword, cstring name,
 
 /* Basic pointer sizes and alignments for the 8051's compiled w/ Keil C51 */
 static machine_spec keil_machine = {
-  "keil", NULL,
+  "keil51", NULL,
   TRUE,                                /* big_endian */
   FALSE,                       /* pcc_bitfield_type_matters */
   8,                           /* empty field boundary - in bits */
@@ -96,12 +101,14 @@ static machine_spec keil_machine = {
   1, 1, 1, 1,                  /* int1/2/4/8 align */
   2, 2,                                /* wchar_t, size_t size */
   TRUE, TRUE,                  /* char, wchar_t signed */
+  "reentrant",                 /* attribute for async functions */
 
   NULL,                                /* adjust_field_align function */
   NULL, NULL, NULL, NULL,      /* attribute handling functions */
   NULL, keil_init,
   keil_token,
   keil_special,                        /* Keil C special */
-  NULL,                                /* global cpp support */
+  gcc_global_cpp_init,         /* global cpp support: this should be tailored to keil
+                                  to get correct behaviour */
   NULL                         /* per-file cpp support */
 };