]>
Commit | Line | Data |
---|---|---|
48d0341c | 1 | #!/usr/bin/perl |
24f4f825 JM |
2 | |
3 | # Print a list of symbols exported by some headers that would | |
4 | # otherwise be in the user's namespace. | |
5 | ||
bfff8b1b | 6 | # Copyright (C) 2014-2017 Free Software Foundation, Inc. |
24f4f825 JM |
7 | # This file is part of the GNU C Library. |
8 | ||
9 | # The GNU C Library is free software; you can redistribute it and/or | |
10 | # modify it under the terms of the GNU Lesser General Public | |
11 | # License as published by the Free Software Foundation; either | |
12 | # version 2.1 of the License, or (at your option) any later version. | |
13 | ||
14 | # The GNU C Library is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | # Lesser General Public License for more details. | |
18 | ||
19 | # You should have received a copy of the GNU Lesser General Public | |
20 | # License along with the GNU C Library; if not, see | |
21 | # <http://www.gnu.org/licenses/>. | |
22 | ||
23 | use GlibcConform; | |
24 | use Getopt::Long; | |
25 | ||
26 | GetOptions ('headers=s' => \$headers, 'standard=s' => \$standard, | |
27 | 'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir); | |
28 | @headers = split (/\s+/, $headers); | |
29 | ||
30 | # Extra symbols possibly not found through -aux-info but still | |
31 | # reserved by the standard: either data symbols, or symbols where the | |
32 | # standard leaves unspecified whether the identifier is a macro or | |
33 | # defined with external linkage. | |
34 | $extra_syms{"ISO"} = ["errno", "setjmp", "va_end"]; | |
35 | $extra_syms{"ISO99"} = ["errno", "math_errhandling", "setjmp", "va_end"]; | |
36 | # stdatomic.h not yet covered by conformance tests; as per DR#419, all | |
37 | # the generic functions there or may not be defined with external | |
38 | # linkage (but are reserved in any case). | |
39 | $extra_syms{"ISO11"} = ["errno", "math_errhandling", "setjmp", "va_end"]; | |
40 | # The following lists may not be exhaustive. | |
41 | $extra_syms{"POSIX"} = ["errno", "setjmp", "va_end", "environ", "sigsetjmp", | |
42 | "optarg", "optind", "opterr", "optopt", "tzname"]; | |
43 | $extra_syms{"XPG3"} = ["errno", "setjmp", "va_end", "environ", "signgam", | |
44 | "loc1", "loc2", "locs", "sigsetjmp", "optarg", | |
45 | "optind", "opterr", "optopt", "daylight", "timezone", | |
46 | "tzname"]; | |
47 | $extra_syms{"XPG4"} = ["errno", "setjmp", "va_end", "environ", "signgam", | |
48 | "loc1", "loc2", "locs", "sigsetjmp", "optarg", | |
49 | "optind", "opterr", "optopt", "daylight", "timezone", | |
84dbedb6 | 50 | "tzname", "getdate_err", "h_errno"]; |
24f4f825 JM |
51 | $extra_syms{"UNIX98"} = ["errno", "setjmp", "va_end", "environ", "signgam", |
52 | "loc1", "loc2", "locs", "sigsetjmp", "optarg", | |
53 | "optind", "opterr", "optopt", "daylight", "timezone", | |
84dbedb6 | 54 | "tzname", "getdate_err", "h_errno"]; |
24f4f825 JM |
55 | $extra_syms{"XOPEN2K"} = ["errno", "setjmp", "va_end", "environ", "signgam", |
56 | "sigsetjmp", "optarg", "optind", "opterr", "optopt", | |
84dbedb6 | 57 | "daylight", "timezone", "tzname", "getdate_err", |
bf143578 | 58 | "h_errno", "in6addr_any", "in6addr_loopback"]; |
24f4f825 JM |
59 | $extra_syms{"XOPEN2K8"} = ["errno", "setjmp", "va_end", "environ", "signgam", |
60 | "sigsetjmp", "optarg", "optind", "opterr", "optopt", | |
bf143578 JM |
61 | "daylight", "timezone", "tzname", "getdate_err", |
62 | "in6addr_any", "in6addr_loopback"]; | |
24f4f825 JM |
63 | $extra_syms{"POSIX2008"} = ["errno", "setjmp", "va_end", "environ", |
64 | "sigsetjmp", "optarg", "optind", "opterr", "optopt", | |
bf143578 | 65 | "tzname", "in6addr_any", "in6addr_loopback"]; |
24f4f825 JM |
66 | |
67 | %user_syms = (); | |
68 | ||
69 | foreach my $header (@headers) { | |
70 | @syms = list_exported_functions ("$CC $flags", $standard, $header, $tmpdir); | |
71 | foreach my $sym (@syms) { | |
72 | if ($sym !~ /^_/) { | |
73 | $user_syms{$sym} = 1; | |
74 | } | |
75 | } | |
76 | } | |
77 | foreach my $sym (@{$extra_syms{$standard}}) { | |
78 | $user_syms{$sym} = 1; | |
79 | } | |
80 | ||
81 | foreach my $sym (sort keys %user_syms) { | |
82 | print "$sym\n"; | |
83 | } |