compiler/grammar; bootstrap: Fixed comma warning case to be consistent
authorJerome St-Louis <jerome@ecere.com>
Tue, 6 May 2014 10:26:48 +0000 (06:26 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 6 May 2014 10:28:19 +0000 (06:28 -0400)
- Added missing null pointer checks in pass2
- Updated bootstrap

compiler/bootstrap/libec/bootstrap/expression.c
compiler/bootstrap/libec/bootstrap/grammar.c
compiler/bootstrap/libec/bootstrap/pass15.c
compiler/bootstrap/libec/bootstrap/pass2.c
compiler/bootstrap/libec/bootstrap/type.c
compiler/libec/precompiled/expression.c
compiler/libec/precompiled/grammar.c
compiler/libec/precompiled/type.c
compiler/libec/src/grammar.ec
compiler/libec/src/grammar.y
compiler/libec/src/pass2.ec

index ff66dad..9ab737b 100644 (file)
@@ -2003,28 +2003,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
index c5e4ff3..fe5cffd 100644 (file)
@@ -2964,28 +2964,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
@@ -10283,7 +10283,7 @@ yyval.initializer->loc = (yyloc);
 break;
 case 993:
 {
-Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "Extra comma\n", (((void *)0))));
+Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "extra comma\n", (((void *)0))));
 yyval.initializer = MkInitializerList(yyvsp[(2) - (4)].list);
 yyval.initializer->loc = (yyloc);
 {
index 5fea534..63c97e4 100644 (file)
@@ -13583,7 +13583,7 @@ int c;
 for(c = 0; c < definedExpStackPos; c++)
 if(definedExpStack[c] == definedExp)
 break;
-if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
+if(c == definedExpStackPos && c < sizeof (definedExpStack) / sizeof(void *))
 {
 struct Location backupYylloc = yylloc;
 struct __ecereNameSpace__ecere__com__Instance * backInput = fileInput;
index 0572cb0..b168ea6 100644 (file)
@@ -3636,6 +3636,8 @@ static void ProcessInitializer(struct Initializer * init)
 switch(init->type)
 {
 case 0:
+if(init->exp)
+{
 init->exp->usage = (init->exp->usage & ~0x1) | (((unsigned int)0x1) << 0);
 ProcessExpression(init->exp);
 if(init->exp->destType && init->exp->destType->kind == 8 && init->exp->destType->_class && init->exp->destType->_class->registered && init->exp->destType->_class->registered->type == 5)
@@ -3644,13 +3646,17 @@ FixReference(init->exp, 0x1);
 }
 else if(init->exp->destType && init->exp->destType->kind == 8)
 FixReference(init->exp, 0x0);
+}
 break;
 case 1:
 {
+if(init->list)
+{
 struct Initializer * i;
 
 for(i = (*init->list).first; i; i = i->next)
 ProcessInitializer(i);
+}
 break;
 }
 }
index cad118b..ef2ea5d 100644 (file)
@@ -2129,28 +2129,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
index 2ca8ec0..8bd24c8 100644 (file)
@@ -2003,28 +2003,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
index ca94a78..2540675 100644 (file)
@@ -2964,28 +2964,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
@@ -10283,7 +10283,7 @@ yyval.initializer->loc = (yyloc);
 break;
 case 993:
 {
-Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "Extra comma\n", (((void *)0))));
+Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "extra comma\n", (((void *)0))));
 yyval.initializer = MkInitializerList(yyvsp[(2) - (4)].list);
 yyval.initializer->loc = (yyloc);
 {
index f787dc4..24c566e 100644 (file)
@@ -2129,28 +2129,28 @@ do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof *(yyss));
+__builtin_memcpy(&(*yyptr).yyss_alloc, yyss, (yysize) * sizeof (*(yyss)));
 yyss = &(*yyptr).yyss_alloc;
-yynewbytes = yystacksize * sizeof *yyss + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyss) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof *(yyvs));
+__builtin_memcpy(&(*yyptr).yyvs_alloc, yyvs, (yysize) * sizeof (*(yyvs)));
 yyvs = &(*yyptr).yyvs_alloc;
-yynewbytes = yystacksize * sizeof *yyvs + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyvs) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 do
 {
 unsigned int yynewbytes;
 
-__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof *(yyls));
+__builtin_memcpy(&(*yyptr).yyls_alloc, yyls, (yysize) * sizeof (*(yyls)));
 yyls = &(*yyptr).yyls_alloc;
-yynewbytes = yystacksize * sizeof *yyls + (sizeof(union yyalloc) - 1);
-yyptr += yynewbytes / sizeof *yyptr;
+yynewbytes = yystacksize * sizeof (*yyls) + (sizeof(union yyalloc) - 1);
+yyptr += yynewbytes / sizeof (*yyptr);
 }while((0));
 if(yyss1 != yyssa)
 free(yyss1);
index 98f53f9..34e5559 100644 (file)
@@ -20063,7 +20063,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 3157 "grammar.y"
     {
-         Compiler_Warning($"Extra comma\n");
+         Compiler_Warning($"extra comma\n");
          (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
          (yyval.initializer).loc = (yyloc);
 
index 82b4ac5..96077a3 100644 (file)
@@ -3155,7 +3155,7 @@ initializer:
        | '{' initializer_list '}'       { $$ = MkInitializerList($2); $$.loc = @$; }
        | '{' initializer_list ',' '}'
       {
-         Compiler_Warning($"Extra comma\n");
+         Compiler_Warning($"extra comma\n");
          $$ = MkInitializerList($2);
          $$.loc = @$;
 
index fba435e..5e08824 100644 (file)
@@ -2972,21 +2972,27 @@ static void ProcessInitializer(Initializer init)
    switch(init.type)
    {
       case expInitializer:
-         init.exp.usage.usageGet = true;
-         ProcessExpression(init.exp);
-         if(init.exp.destType && init.exp.destType.kind == classType && init.exp.destType._class &&
-            init.exp.destType._class.registered && init.exp.destType._class.registered.type == noHeadClass)
+         if(init.exp)
          {
-            FixReference(init.exp, true);
+            init.exp.usage.usageGet = true;
+            ProcessExpression(init.exp);
+            if(init.exp.destType && init.exp.destType.kind == classType && init.exp.destType._class &&
+               init.exp.destType._class.registered && init.exp.destType._class.registered.type == noHeadClass)
+            {
+               FixReference(init.exp, true);
+            }
+            else if(init.exp.destType && init.exp.destType.kind == classType)
+               FixReference(init.exp, false);
          }
-         else if(init.exp.destType && init.exp.destType.kind == classType)
-            FixReference(init.exp, false);
          break;
       case listInitializer:
       {
-         Initializer i;
-         for(i = init.list->first; i; i = i.next)
-            ProcessInitializer(i);
+         if(init.list)
+         {
+            Initializer i;
+            for(i = init.list->first; i; i = i.next)
+               ProcessInitializer(i);
+         }
          break;
       }
    }