From c0df9205e6b326a36dab15d1dcf9659e7ce03796 Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Tue, 14 Jun 2016 15:55:01 +0900 Subject: [PATCH] C++, skip adding already used old-style ids. See michaeljones/breathe#266. --- sphinx/domains/cpp.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index a64b488cd..46f775e44 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -3738,7 +3738,7 @@ class CPPObject(ObjectDescription): id_v1 = None id_v2 = ast.get_id_v2() # store them in reverse order, so the newest is first - ids = [id_v2, id_v1] + ids = [id_v2, id_v1] newestId = ids[0] assert newestId # shouldn't be None @@ -3759,8 +3759,14 @@ class CPPObject(ObjectDescription): else: # print("[CPP] non-unique name:", name) pass - for id in ids: - if id: # is None when the element didn't exist in that version + # always add the newest id + assert newestId + signode['ids'].append(newestId) + # only add compatibility ids when there are no conflicts + for id in ids[1:]: + if not id: # is None when the element didn't exist in that version + continue + if id not in self.state.document.ids: signode['ids'].append(id) signode['first'] = (not self.names) # hmm, what is this abound? self.state.document.note_explicit_target(signode)