--- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1198,7 +1198,7 @@ def __init__ (self, typename, val): self.typename = strip_versioned_namespace(typename) - self.typename = re.sub('^std::experimental::fundamentals_v\d::', 'std::experimental::', self.typename, 1) + self.typename = re.sub(r'^std::experimental::fundamentals_v\d::', 'std::experimental::', self.typename, 1) self.val = val self.contained_type = None contained_value = None @@ -1299,7 +1299,7 @@ mgrtypes = [] for s in strings: try: - x = re.sub("std::string(?!\w)", s, m.group(1)) + x = re.sub(r"std::string(?!\w)", s, m.group(1)) # The following lookup might raise gdb.error if the # manager function was never instantiated for 's' in the # program, because there will be no such type. @@ -1246,7 +1246,7 @@ def __init__ (self, typename, val): valtype = self._recognize (val.type.template_argument(0)) typename = strip_versioned_namespace(typename) - self.typename = re.sub('^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1) + self.typename = re.sub(r'^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1) payload = val['_M_payload'] if self.typename.startswith('std::experimental'): engaged = val['_M_engaged'] diff '--color=auto' -Naur a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py 2022-08-19 08:09:55.524700157 +0000 +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py 2023-12-09 21:06:42.544909771 +0000 @@ -148,7 +148,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?array<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?array<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -265,7 +265,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?deque<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?deque<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -309,7 +309,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?forward_list<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?forward_list<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -390,7 +390,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?(__cxx11::)?list<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?(__cxx11::)?list<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -505,7 +505,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?vector<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?vector<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -554,7 +554,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?%s<.*>$' % self._name, class_type.tag): + if not re.match(r'^std::(__\d+::)?%s<.*>$' % self._name, class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -587,9 +587,9 @@ def __call__(self, obj): impl_type = obj.dereference().type.fields()[0].type.tag # Check for new implementations first: - if re.match('^std::(__\d+::)?__uniq_ptr_(data|impl)<.*>$', impl_type): + if re.match(r'^std::(__\d+::)?__uniq_ptr_(data|impl)<.*>$', impl_type): tuple_member = obj['_M_t']['_M_t'] - elif re.match('^std::(__\d+::)?tuple<.*>$', impl_type): + elif re.match(r'^std::(__\d+::)?tuple<.*>$', impl_type): tuple_member = obj['_M_t'] else: return None @@ -651,7 +651,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?unique_ptr<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?unique_ptr<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: @@ -720,7 +720,7 @@ def __call__(self, obj, index): # Check bounds if _elem_type is an array of known bound - m = re.match('.*\[(\d+)]$', str(self._elem_type)) + m = re.match(r'.*\[(\d+)]$', str(self._elem_type)) if m and index >= int(m.group(1)): raise IndexError('shared_ptr<%s> index "%d" should not be >= %d.' % (self._elem_type, int(index), int(m.group(1)))) @@ -769,7 +769,7 @@ self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): - if not re.match('^std::(__\d+::)?shared_ptr<.*>$', class_type.tag): + if not re.match(r'^std::(__\d+::)?shared_ptr<.*>$', class_type.tag): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: