Skip to content

Commit 04a3c0e

Browse files
adsk-belleyboberpar
authored andcommitted
Pass --no-strip-underscore to c++filt on OS X
* The --no-strip-underscope flag is necessary on OS X so that symbols listed by gcov get demangled properly. From the c++filt man page: "On some systems, both the C and C++ compilers put an underscore in front of every name. For example, the C name "foo" gets the low-level name "_foo". This option tells c++filt not to remove the initial underscore. Whether c++filt removes the underscore by default is target dependent." Signed-off-by: Benoit Belley <[email protected]>
1 parent 632c25a commit 04a3c0e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/genhtml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5325,6 +5325,7 @@ sub demangle_list($)
53255325
my $tmpfile;
53265326
my $handle;
53275327
my %demangle;
5328+
my $demangle_arg = "";
53285329
my %versions;
53295330

53305331
# Write function names to file
@@ -5333,8 +5334,14 @@ sub demangle_list($)
53335334
print($handle join("\n", @$list));
53345335
close($handle);
53355336

5337+
# Extra flag necessary on OS X so that symbols listed by gcov get demangled
5338+
# properly.
5339+
if ($^O eq "darwin") {
5340+
$demangle_arg = "--no-strip-underscores";
5341+
}
5342+
53365343
# Build translation hash from c++filt output
5337-
open($handle, "-|", "c++filt < $tmpfile") or
5344+
open($handle, "-|", "c++filt $demangle_arg < $tmpfile") or
53385345
die("ERROR: could not run c++filt: $!\n");
53395346
foreach my $func (@$list) {
53405347
my $translated = <$handle>;

0 commit comments

Comments
 (0)