x86: Move wcschr SSE2 implementation to multiarch/wcschr-sse2.S
[glibc.git] / scripts / vcstocl_quirks.py
blob763a5920d0c28a5138dc03f0962d13a5182e82db
1 # VCSToChangeLog Quirks for the GNU C Library.
3 # Copyright (C) 2019-2022 Free Software Foundation, Inc.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
19 from frontend_c import Frontend
20 from projectquirks import ProjectQuirks
21 import re
23 class GlibcProjectQuirks(ProjectQuirks):
24 repo = 'git'
26 IGNORE_LIST = [
27 'ChangeLog',
28 'sysdeps/x86_64/dl-trampoline.h'
31 MACRO_QUIRKS = \
32 [{'orig': r'ElfW\((\w+)\)', 'sub': r'\1__ELF_NATIVE_CLASS_t'},
33 {'orig': r'(libc_freeres_fn)\s*\((\w+)\)', 'sub': r'static void \1__\2 (void)'},
34 {'orig': r'(IMPL)\s*\((\w+), .*\)$', 'sub': r'static void \1__\2 (void) {}'},
35 {'orig': r'__(BEGIN|END)_DECLS', 'sub': r''},
36 {'orig': 'weak_function', 'sub': '__attribute__ ((weak))'},
37 {'orig': r'ATTRIBUTE_(CONST|MALLOC|PURE|FORMAT)',
38 'sub': r'__attribute__ ((\1))'},
39 {'orig': r'__THROW', 'sub': r'__attribute__ ((__nothrow__ __LEAF))'},
40 {'orig': r'__THROWNL', 'sub': r'__attribute__ ((__nothrow__))'},
41 {'orig': r'__nonnull \(\(([^)]+)\)\)',
42 'sub': r'__attribute__ ((__nonnull__ \1))'},
43 {'orig': r'([^_])attribute_(\w+)', 'sub': r'\1__attribute__ ((\2))'},
44 {'orig': r'^attribute_(\w+)', 'sub': r'__attribute__ ((\1))'}]
46 def __init__(self, debug):
47 self.debug = debug
48 ''' Build a list of macro calls used for symbol versioning and attributes.
50 glibc uses a set of macro calls that do not end with a semi-colon and hence
51 breaks our parser. Identify those calls from include/libc-symbols.h and
52 filter them out.
53 '''
54 with open('include/libc-symbols.h') as macrofile:
55 op = macrofile.readlines()
56 op = Frontend.remove_comments(self, op)
57 self.C_MACROS = [re.sub(r'.*define (\w+).*', r'\1', x[:-1]) for x in op \
58 if 'define ' in x]
60 super().__init__()
62 def get_project_quirks(debug):
63 ''' Accessor function.
64 '''
65 return GlibcProjectQuirks(debug)