dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. e7b771770b514589ee8a7c84781fd17ef7ceaf8a
Date: Thu, 13 Aug 2009 17:49:23 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".

The branch, master has been updated
       via  e7b771770b514589ee8a7c84781fd17ef7ceaf8a (commit)
      from  583820da7c37f3a81b18c8d2f20dbd1e27f20673 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=e7b771770b514589ee8a7c84781fd17ef7ceaf8a

commit e7b771770b514589ee8a7c84781fd17ef7ceaf8a
Author: Klaus Treichel <address@hidden>
Date:   Thu Aug 13 19:48:58 2009 +0200

    Filter duplicates in the list of implemented interfaces and throw an
    error in that case.

diff --git a/ChangeLog b/ChangeLog
index 997f776..ba0e242 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-13  Klaus Treichel  <address@hidden>
+
+       * cscc/csharp/cs_gather.c (AddImplementedInterface): Add helper function
+       for adding an interface to the implement list and check for duplicates.
+       (CollectBaseClasses, AddBaseClasses): Use the new helper function for
+       adding implemented interfaces to the list.
+
 2009-08-10  Klaus Treichel  <address@hidden>
 
        * codegen/cg_nodes.tc (ILNode_VariableDeclarator): Added.
diff --git a/cscc/csharp/cs_gather.c b/cscc/csharp/cs_gather.c
index 0a9d3bc..450b10e 100644
--- a/cscc/csharp/cs_gather.c
+++ b/cscc/csharp/cs_gather.c
@@ -555,6 +555,36 @@ static void AddObjectParent(ILGenInfo *info,
 }
 
 /*
+ * Check if an interface is already declared in the implement list and add
+ * it to the list if not.
+ * If reportError is != 0 an error is reported.
+ */
+static void AddImplementedInterface(ILGenInfo *info,
+                                                                       ILNode 
*node,
+                                                                       
ILProgramItem **implementList,
+                                                                       
ILUInt32 *numImplements,
+                                                                       
ILProgramItem *interface,
+                                                                       int 
reportError)
+{
+       ILUInt32 current;
+
+       for(current = 0; current < *numImplements; ++current)
+       {
+               if(implementList[current] == interface)
+               {
+                       if(reportError)
+                       {
+                               CCErrorOnLine(yygetfilename(node), 
yygetlinenum(node),
+                                       "interface declared multiple times in 
implement list");
+                       }
+                       return;
+               }
+       }
+       implementList[*numImplements] = interface;
+       *numImplements += 1;
+}
+
+/*
  * Collect the base classes for one class definition.
  * The implement list must be large enough to hold all implemented
  * interfaces of this class definition.
@@ -653,7 +683,9 @@ static void CollectBaseClasses(ILGenInfo *info,
                                        else
                                        {
                                                /* First base in the list is an 
interface */
-                                               implementList[currentImpl++] = 
baseItem;
+                                               AddImplementedInterface(info, 
baseNode,
+                                                                               
                implementList, &currentImpl,
+                                                                               
                baseItem, 1);
                                        }
                                }
                                else
@@ -686,7 +718,9 @@ static void CollectBaseClasses(ILGenInfo *info,
                                        }
                                        else
                                        {
-                                               implementList[currentImpl++] = 
baseItem;
+                                               AddImplementedInterface(info, 
baseNode,
+                                                                               
                implementList, &currentImpl,
+                                                                               
                baseItem, 1);
                                        }
                                }
                        }
@@ -799,7 +833,11 @@ static void AddBaseClasses(ILGenInfo *info,
                                                        /* Add the interfaces 
to the main part list */
                                                        for(base = 0; base < 
numPartBases; ++base)
                                                        {
-                                                               
baseList[numBases++] = partBaseList[base];
+                                                               /* Filter 
duplicates if present */
+                                                               
AddImplementedInterface(info, part,
+                                                                               
                                baseList, &numBases,
+                                                                               
                                partBaseList[base],
+                                                                               
                                0);
                                                        }
                                                }
                                        }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    7 +++++++
 cscc/csharp/cs_gather.c |   44 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 48 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
DotGNU Portable.NET engine, compilers and tools (pnet)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]