X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2e8477aa5561fd31e5e72f6ed2a704476e903b5b..12f4d48896952768d3df0d5704c4e8414027af2a:/tools/doxygen/xbt_log_extract_hierarchy.pl diff --git a/tools/doxygen/xbt_log_extract_hierarchy.pl b/tools/doxygen/xbt_log_extract_hierarchy.pl index 28db03217e..baa3b8d352 100755 --- a/tools/doxygen/xbt_log_extract_hierarchy.pl +++ b/tools/doxygen/xbt_log_extract_hierarchy.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# Copyright (c) 2008, 2010, 2012-2014. The SimGrid Team. +# Copyright (c) 2008-2018. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it @@ -18,12 +18,10 @@ print " \@{\n"; # Search for calls to macros defining new channels, and prepare the tree representation my %ancestor; my %desc; -# $ancestor{"toto"} is the ancestor of the toto channel as declared by XBT_LOG_NEW_SUBCATEGORY and +# $ancestor{"toto"} is the ancestor of the toto channel as declared by XBT_LOG_NEW_SUBCATEGORY and # XBT_LOG_NEW_DEFAULT_SUBCATEGORY ie, when the channel toto is initialized (does not work under windows) # $desc{"toto"} is its description -my %connected; -# $connected{"toto"} is defined if XBT_LOG_CONNECT("toto") is used sub cleanup_ctn { my $ctn = shift; # cleanup the content of a macro call @@ -59,18 +57,15 @@ sub parse_file { } close IN; - # Purge $data from C comments + # Purge $data from C and C++ comments $data =~ s|/\*.*?\*/||sg; - - # C++ comments are forbiden in SG for portability reasons, but deal with it anyway $data =~ s|//.*$||mg; - my $connect_data = $data; # save a copy for second parsing phase while ($data =~ s/^.*?XBT_LOG_NEW(_DEFAULT)?_(SUB)?CATEGORY\(//s) { $data =~ s/([^"]*"[^"]*")\)//s || die "unparsable macro: $data"; my ($name,$anc,$desc) = cleanup_ctn($1); - + # build the tree, checking for name conflict die "ERROR: Category name conflict: $name used several times (in $ancestor{$name} and $anc, last time in $filename)\n" if defined ($ancestor{$name}) && $ancestor{$name} ne $anc && defined ($desc{$name}) && $desc{$name} ne $desc; @@ -79,13 +74,6 @@ sub parse_file { print " $name -> $anc\n" if $debug; } - - # Now, look for XBT_LOG_CONNECT calls - $data = $connect_data; - while ($data =~ s/^.*?XBT_LOG_CONNECT\(//s) { - $data =~ s/\s*(\w+)\s*\)//s || die "unparsable macro: $data"; - $connected{$1} = 1; - } } # Retrieve all the file names, and add their content to $data my $data; @@ -94,15 +82,16 @@ while (my $file=) { chomp $file; parse_file($file); } +parse_file("../include/xbt/sysdep.h"); close FILES; -# Display the tree, looking for disconnected elems +# Display the tree, looking for disconnected elems my %used; sub display_subtree { my $name=shift; my $indent=shift; - + $used{$name} = 1; unless ($name eq "XBT_LOG_ROOT_CAT") { # do not display the root print "$indent - $name: ".($desc{$name}|| "(undocumented)")."\n"; @@ -114,11 +103,6 @@ sub display_subtree { display_subtree("XBT_LOG_ROOT_CAT",""); -map { - if ($_ ne "mc_main") { # This one is not in libsimgrid - warn "Category $_ does not seem to be connected. Use XBT_LOG_CONNECT($_).\n"; - } -} grep {!defined $connected{$_}} sort keys %ancestor; map { warn "Category $_ does not seem to be connected to the root (anc=$ancestor{$_})\n"; } grep {!defined $used{$_}} sort keys %ancestor;