public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Replace use of reserved name that clashes [PR 97362]
@ 2020-10-10 20:22 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-10-10 20:22 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

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.
	* testsuite/17_intro/badnames.cc: Check __deref.

Tested powerpc64le-linux. Committed to trunk.

This needs to be backported too.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3045 bytes --]

commit 2137aa92412da363d52ef699987441be28b239d0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Oct 10 21:22:12 2020

    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.
            * testsuite/17_intro/badnames.cc: Check __deref.

diff --git a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
index 00991128525..4380cbbe3f1 100644
--- a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
+++ b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
@@ -412,8 +412,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>
@@ -445,6 +446,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 aaccc8dfe07..942d35f358d 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -421,10 +421,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>())>
       _GLIBCXX20_CONSTEXPR
       static bool
       _S_is_valid(_It __it)
@@ -438,7 +438,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>()))>
       _GLIBCXX20_CONSTEXPR
       static bool
       _S_is_valid_pred(_It __it, _Pred __pred)
diff --git a/libstdc++-v3/testsuite/17_intro/badnames.cc b/libstdc++-v3/testsuite/17_intro/badnames.cc
index c69b8c45d81..a6b98db26f2 100644
--- a/libstdc++-v3/testsuite/17_intro/badnames.cc
+++ b/libstdc++-v3/testsuite/17_intro/badnames.cc
@@ -62,6 +62,7 @@
 
 // MS adds:
 #define _T		_T is a BADNAME
+#define __deref		__deref is a BADNAME
 
 // BSD adds:
 #define __used		__used is a BADNAME

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-10 20:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 20:22 [committed] libstdc++: Replace use of reserved name that clashes [PR 97362] Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).