[pygccxml-commit] SF.net SVN: pygccxml:[1805] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2010-01-16 19:14:31
|
Revision: 1805 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1805&view=rev Author: roman_yakovenko Date: 2010-01-16 19:14:12 +0000 (Sat, 16 Jan 2010) Log Message: ----------- fix bug related to merging free functions Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/calldef.py pygccxml_dev/pygccxml/declarations/decl_printer.py pygccxml_dev/unittests/xmlfile_reader_tester.py Added Paths: ----------- pygccxml_dev/unittests/data/merge_free_functions.hpp Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2010-01-14 12:54:55 UTC (rev 1804) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2010-01-16 19:14:12 UTC (rev 1805) @@ -262,6 +262,7 @@ from mdecl_wrapper import mdecl_wrapper_t from decl_printer import decl_printer_t +from decl_printer import dump_declarations from decl_printer import print_declarations @@ -334,10 +335,3 @@ __impl_matchers[ namespace_t.free_operator ] = operator_matcher_t __impl_decl_types[ namespace_t.free_operator ] = free_operator_t - - - - - - - Modified: pygccxml_dev/pygccxml/declarations/calldef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/calldef.py 2010-01-14 12:54:55 UTC (rev 1804) +++ pygccxml_dev/pygccxml/declarations/calldef.py 2010-01-16 19:14:12 UTC (rev 1805) @@ -177,7 +177,8 @@ , self.return_type , self.has_extern , self.does_throw - , self._sorted_list( self.exceptions ) ] + , self._sorted_list( self.exceptions ) + , self.demangled_name ] items.extend( self._get__cmp__call_items() ) return items @@ -188,8 +189,8 @@ and self.arguments == other.arguments \ and self.has_extern == other.has_extern \ and self.does_throw == other.does_throw \ - and self._sorted_list( self.exceptions ) \ - == other._sorted_list( other.exceptions ) + and self._sorted_list( self.exceptions ) == other._sorted_list( other.exceptions ) \ + and self.demangled_name == other.demangled_name def _get_arguments(self): return self._arguments Modified: pygccxml_dev/pygccxml/declarations/decl_printer.py =================================================================== --- pygccxml_dev/pygccxml/declarations/decl_printer.py 2010-01-14 12:54:55 UTC (rev 1804) +++ pygccxml_dev/pygccxml/declarations/decl_printer.py 2010-01-16 19:14:12 UTC (rev 1805) @@ -285,3 +285,14 @@ prn.level = 0 prn.instance = d algorithm.apply_visitor(prn, d) + +def dump_declarations( decls, fpath ): + """ + dump declarations tree rooted at each of the included nodes to the file + + :param decls: either a single :class:declaration_t object or list of :class:declaration_t objects + :param fpath: file name + """ + fobj = file( fpath, 'w+' ) + print_declarations( decls, writer=fobj.write ) + fobj.close() Added: pygccxml_dev/unittests/data/merge_free_functions.hpp =================================================================== --- pygccxml_dev/unittests/data/merge_free_functions.hpp (rev 0) +++ pygccxml_dev/unittests/data/merge_free_functions.hpp 2010-01-16 19:14:12 UTC (rev 1805) @@ -0,0 +1,32 @@ +// Copyright 2004-2008 Roman Yakovenko. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef __merge_free_functions_hpp__ +#define __merge_free_functions_hpp__ + +#include <iostream> + +/* +namespace n1{ + +struct s1{}; +struct s2{}; + +template<typename _Facet> +bool has_facet(int i) throw(){ + return false; +} + +void do_smth(){ + has_facet<s1>( 12 ); + has_facet<s2>( 12 ); +} + +} +*/ + + +#endif//__merge_free_functions_hpp__ + Modified: pygccxml_dev/unittests/xmlfile_reader_tester.py =================================================================== --- pygccxml_dev/unittests/xmlfile_reader_tester.py 2010-01-14 12:54:55 UTC (rev 1804) +++ pygccxml_dev/unittests/xmlfile_reader_tester.py 2010-01-16 19:14:12 UTC (rev 1805) @@ -3,6 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import os import unittest import autoconfig import parser_test_case @@ -14,13 +15,15 @@ class tester_t( parser_test_case.parser_test_case_t ): def __init__(self, *args): parser_test_case.parser_test_case_t.__init__(self, *args) - self.__fname = 'core_types.hpp' + #self.__fname = 'core_types.hpp' + self.__fname = 'merge_free_functions.hpp' def test(self): src_reader = parser.source_reader_t( self.config ) src_decls = src_reader.read_file( self.__fname ) xmlfile = src_reader.create_xml_file( self.__fname ) + print xmlfile try: fconfig = parser.file_configuration_t( data=xmlfile , start_with_declarations=None @@ -29,11 +32,16 @@ prj_reader = parser.project_reader_t( self.config ) prj_decls = prj_reader.read_files( [fconfig] , compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE ) - - self.failUnless( src_decls == prj_decls - , "There is a difference between declarations in file %s." % self.__fname ) + + declarations.dump_declarations( src_decls + , os.path.join( autoconfig.build_directory, 'xmlfile_reader.src.txt' ) ) + declarations.dump_declarations( prj_decls + , os.path.join( autoconfig.build_directory, 'xmlfile_reader.prj.txt' ) ) + + if src_decls != prj_decls: + self.fail( "There is a difference between declarations in file %s." % self.__fname ) finally: - utils.remove_file_no_raise( xmlfile ) + pass #utils.remove_file_no_raise( xmlfile ) def create_suite(): suite = unittest.TestSuite() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |