4324b82 Prevent infinite loops while comparing two function_type

Authored and Committed by Dodji Seketeli 8 years ago
    Prevent infinite loops while comparing two function_type
    
    While comparing two function types a given sub-type can itself have a
    sub-type that *is* the same function_type as the one we are looking
    at.  In that case, an infinite loop appears.
    
    This patch detects those cases, similarly to what we do for class_decl
    and avoids the eventual infinite loop.
    
    	* include/abg-ir.h (class environment): Make class function_type
    	be a friend of this class.
    	(class function_type): Make the equality function for
    	function_types be a friend of this class.
    	* src/abg-ir.cc (environment::priv::fn_types_being_compared_): New
    	data member.
    	(function_type::priv::{mark_as_being_compared,
    	unmark_as_being_compared, comparison_started}): Define new member
    	functions.
    	(equals): In the overload for function_types, if any of the the
    	function_type being compared is already being compared, return
    	early saying that the two function_types are equal.  This avoids
    
    Signed-off-by: Dodji Seketeli <dodji@redhat.com>
    
        
file modified
+4 -0
file modified
+68 -8