[gcc r8-10851] libstdc++: Replace use of reserved name that clashes [PR 97362]

Jonathan Wakely redi@gcc.gnu.org
Mon Apr 19 10:26:56 GMT 2021


https://gcc.gnu.org/g:661dacec8fb149582a2508494ed927ee3387c7f0

commit r8-10851-g661dacec8fb149582a2508494ed927ee3387c7f0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Oct 10 21:22:12 2020 +0100

    libstdc++: Replace use of reserved name that clashes [PR 97362]
    
    The name __deref is defined as a macro by Windows headers.
    
    This renames the __deref() helper function to __ref. It doesn't actually
    dereference an iterator. it just has the same type as the iterator's
    reference type.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97362
            * doc/html/manual/source_code_style.html: Regenerate.
            * doc/xml/manual/appendix_contributing.xml: Add __deref to
            BADNAMES.
            * include/debug/functions.h (_Irreflexive_checker::__deref):
            Rename to __ref.
    
    (cherry picked from commit 2137aa92412da363d52ef699987441be28b239d0)

Diff:
---
 libstdc++-v3/doc/html/manual/source_code_style.html   | 1 +
 libstdc++-v3/doc/xml/manual/appendix_contributing.xml | 6 ++++--
 libstdc++-v3/include/debug/functions.h                | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/source_code_style.html b/libstdc++-v3/doc/html/manual/source_code_style.html
index 19224b7ec13..d1a5804338b 100644
--- a/libstdc++-v3/doc/html/manual/source_code_style.html
+++ b/libstdc++-v3/doc/html/manual/source_code_style.html
@@ -32,6 +32,7 @@
 <br />
       MS adds:<br />
       _T<br />
+			__deref<br />
 <br />
       BSD adds:<br />
       __used<br />
diff --git a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
index eb011cbd4bc..f69ad1f9175 100644
--- a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
+++ b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
@@ -414,8 +414,9 @@ indicate a place that may require attention for multi-thread safety.
   
   <para>
   </para>
-  <section xml:id="coding_style.bad_identifiers"><info><title>Bad Identifiers</title></info>
-    
+
+  <section xml:id="coding_style.bad_identifiers"><info><title>Bad Identifiers</title></info> <!-- BADNAMES -->
+
     <para>
       Identifiers that conflict and should be avoided.
     </para>
@@ -447,6 +448,7 @@ indicate a place that may require attention for multi-thread safety.
 
       MS adds:
       _T
+			__deref
 
       BSD adds:
       __used
diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h
index 57cc6826ce0..8f52326de26 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -449,10 +449,10 @@ namespace __gnu_debug
   {
     template<typename _It>
       static typename std::iterator_traits<_It>::reference
-      __deref();
+      __ref();
 
     template<typename _It,
-	     typename = decltype(__deref<_It>() < __deref<_It>())>
+	     typename = decltype(__ref<_It>() < __ref<_It>())>
       static bool
       _S_is_valid(_It __it)
       { return !(*__it < *__it); }
@@ -464,7 +464,7 @@ namespace __gnu_debug
       { return true; }
 
     template<typename _It, typename _Pred, typename
-	= decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
+	= decltype(std::declval<_Pred>()(__ref<_It>(), __ref<_It>()))>
       static bool
       _S_is_valid_pred(_It __it, _Pred __pred)
       { return !__pred(*__it, *__it); }


More information about the Libstdc++-cvs mailing list