Update iso14651_t1_common file to ISO14651_2016_TABLE1_en.txt [BZ #14095]
[glibc.git] / conform / list-header-symbols.pl
blob0db61bfe86bb903378f5a6c6895b01cc1718aaa1
1 #!/usr/bin/perl
3 # Print a list of symbols exported by some headers that would
4 # otherwise be in the user's namespace.
6 # Copyright (C) 2014-2018 Free Software Foundation, Inc.
7 # This file is part of the GNU C Library.
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.
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.
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/>.
23 use GlibcConform;
24 use Getopt::Long;
26 GetOptions ('headers=s' => \$headers, 'standard=s' => \$standard,
27 'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir);
28 @headers = split (/\s+/, $headers);
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{"XPG4"} = ["errno", "setjmp", "va_end", "environ", "signgam",
44 "loc1", "loc2", "locs", "sigsetjmp", "optarg",
45 "optind", "opterr", "optopt", "daylight", "timezone",
46 "tzname"];
47 $extra_syms{"XPG42"} = ["errno", "setjmp", "va_end", "environ", "signgam",
48 "loc1", "loc2", "locs", "sigsetjmp", "optarg",
49 "optind", "opterr", "optopt", "daylight", "timezone",
50 "tzname", "getdate_err", "h_errno"];
51 $extra_syms{"UNIX98"} = ["errno", "setjmp", "va_end", "environ", "signgam",
52 "loc1", "loc2", "locs", "sigsetjmp", "optarg",
53 "optind", "opterr", "optopt", "daylight", "timezone",
54 "tzname", "getdate_err", "h_errno"];
55 $extra_syms{"XOPEN2K"} = ["errno", "setjmp", "va_end", "environ", "signgam",
56 "sigsetjmp", "optarg", "optind", "opterr", "optopt",
57 "daylight", "timezone", "tzname", "getdate_err",
58 "h_errno", "in6addr_any", "in6addr_loopback"];
59 $extra_syms{"XOPEN2K8"} = ["errno", "setjmp", "va_end", "environ", "signgam",
60 "sigsetjmp", "optarg", "optind", "opterr", "optopt",
61 "daylight", "timezone", "tzname", "getdate_err",
62 "in6addr_any", "in6addr_loopback"];
63 $extra_syms{"POSIX2008"} = ["errno", "setjmp", "va_end", "environ",
64 "sigsetjmp", "optarg", "optind", "opterr", "optopt",
65 "tzname", "in6addr_any", "in6addr_loopback"];
67 %user_syms = ();
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;
77 foreach my $sym (@{$extra_syms{$standard}}) {
78 $user_syms{$sym} = 1;
81 foreach my $sym (sort keys %user_syms) {
82 print "$sym\n";