From 99cafe0f05b9e19e004a93bd3fe5ac271c1fa37b Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 21 Nov 2011 10:34:53 +0100
Subject: [PATCH] build-rpc: Fail if call is defined more than once

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 autotools/build-rpc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/autotools/build-rpc b/autotools/build-rpc
index 222619f2a..576dd0d28 100755
--- a/autotools/build-rpc
+++ b/autotools/build-rpc
@@ -187,6 +187,12 @@ def main():
     assert module.SINGLE == _SINGLE
     assert module.MULTI == _MULTI
 
+    dups = utils.FindDuplicates(itertools.chain(*map(lambda value: value.keys(),
+                                                     module.CALLS.values())))
+    if dups:
+      raise Exception("Found duplicate RPC definitions for '%s'" %
+                      utils.CommaJoin(sorted(dups)))
+
     for (clsname, calls) in module.CALLS.items():
       _WriteBaseClass(sw, clsname, calls.values())
 
-- 
GitLab