source: trunk/PERL2ARB/warn_undefined_symbols.pl

Last change on this file was 19493, checked in by westram, 12 months ago
  • homebrew build looked for wrong lib-suffix. patch from jan. thx :)
  • fixed a typo in warn_undefined_symbols.pl
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/usr/bin/perl
2
3# --------------------
4# This script warns about undefined symbols in the arb perl module
5#     ../lib/ARB.pm
6#
7# Most public functions in library ARBDB will be exported to arb perl.
8#
9# If you get warnings about unsatisfied symbols you should fix them,
10# as they will cause runtime errors on some systems (macOS >= 12).
11#
12# Possible fixes:
13# - declare function as 'static'
14# - prefix a function with 'NOT4PERL' to avoid it gets exported.
15#
16# --------------------
17
18use strict;
19use warnings;
20
21sub warn_undefined_symbols() {
22  my $warned = 0;
23
24  while (defined($_=<>)) {
25    chomp;
26
27    my ($sym, $rest);
28    if (/ [A-Z] /o) { ($sym, $rest) = ($`, $&.$'); }
29    else            { ($sym, $rest) = ($_, undef); }
30
31    my $msgtype = 'Warning';
32
33    if    ($sym =~ /^Perl_/o) { $msgtype = undef; }
34    elsif ($sym =~ /^PL_/o) { $msgtype = undef; }
35    elsif ($sym =~ /^pthread_getspecific$/o) { $msgtype = undef; }
36    elsif ($sym =~ /\@\@(GCC|CXXABI|GLIBC|GLIBCXX)_[0-9\.]+/o) { $msgtype = undef; }
37
38    if (defined $msgtype) {
39      print "ARB.c:0: $msgtype: xsub references unsatisfied symbol '$sym'\n";
40      $warned++;
41    }
42  }
43
44  if ($warned>0) {
45    print "warn_undefined_symbols.pl:4: Note: unsatisfied symbols may cause runtime errors in perl scripts\n";
46  }
47}
48
49warn_undefined_symbols();
Note: See TracBrowser for help on using the repository browser.