]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Adjust uses of null pointer constants in docs
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Apr 2023 23:07:36 +0000 (00:07 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 18 Apr 2023 23:13:02 +0000 (00:13 +0100)
libstdc++-v3/ChangeLog:

* doc/xml/manual/extensions.xml: Fix example to declare and
qualify std::free, and use NULL instead of 0.
* doc/html/manual/ext_demangling.html: Regenerate.
* libsupc++/cxxabi.h: Adjust doxygen comments.

libstdc++-v3/doc/html/manual/ext_demangling.html
libstdc++-v3/doc/xml/manual/extensions.xml
libstdc++-v3/libsupc++/cxxabi.h

index 028ec71d8c818946ebb43ddfc2c3f67deb1e4808..1e7cdda832668c6ea0551180e923c18a81255d48 100644 (file)
@@ -26,6 +26,7 @@
   </p><pre class="programlisting">
 #include &lt;exception&gt;
 #include &lt;iostream&gt;
+#include &lt;cstdlib&gt;
 #include &lt;cxxabi.h&gt;
 
 struct empty { };
@@ -33,7 +34,6 @@ struct empty { };
 template &lt;typename T, int N&gt;
   struct bar { };
 
-
 int main()
 {
   int     status;
@@ -43,11 +43,9 @@ int main()
   bar&lt;empty,17&gt;          u;
   const std::type_info  &amp;ti = typeid(u);
 
-  realname = abi::__cxa_demangle(ti.name(), 0, 0, &amp;status);
+  realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &amp;status);
   std::cout &lt;&lt; ti.name() &lt;&lt; "\t=&gt; " &lt;&lt; realname &lt;&lt; "\t: " &lt;&lt; status &lt;&lt; '\n';
-  free(realname);
-
-  return 0;
+  std::free(realname);
 }
    </pre><p>
      This prints
index 196b55d83479196bd5361037482b480cdd3c5ce4..daa98f5cba746b870fc8b5d581002497bb40e583 100644 (file)
@@ -521,6 +521,7 @@ get_temporary_buffer(5, (int*)0);
    <programlisting>
 #include &lt;exception&gt;
 #include &lt;iostream&gt;
+#include &lt;cstdlib&gt;
 #include &lt;cxxabi.h&gt;
 
 struct empty { };
@@ -528,7 +529,6 @@ struct empty { };
 template &lt;typename T, int N&gt;
   struct bar { };
 
-
 int main()
 {
   int     status;
@@ -538,11 +538,9 @@ int main()
   bar&lt;empty,17&gt;          u;
   const std::type_info  &amp;ti = typeid(u);
 
-  realname = abi::__cxa_demangle(ti.name(), 0, 0, &amp;status);
+  realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &amp;status);
   std::cout &lt;&lt; ti.name() &lt;&lt; "\t=&gt; " &lt;&lt; realname &lt;&lt; "\t: " &lt;&lt; status &lt;&lt; '\n';
-  free(realname);
-
-  return 0;
+  std::free(realname);
 }
    </programlisting>
    <para>
index 10179bc0a0dfc7a0ec57ea8ab0f65fcf3e6b8e97..ac0637b0343c74840008639157350a81b7502de7 100644 (file)
@@ -169,7 +169,7 @@ namespace __cxxabiv1
    *  @param __output_buffer A region of memory, allocated with
    *  malloc, of @a *__length bytes, into which the demangled name is
    *  stored.  If @a __output_buffer is not long enough, it is
-   *  expanded using realloc.  @a __output_buffer may instead be NULL;
+   *  expanded using realloc.  @a __output_buffer may instead be null;
    *  in that case, the demangled name is placed in a region of memory
    *  allocated with malloc.
    *
@@ -184,7 +184,7 @@ namespace __cxxabiv1
    *  -3: One of the arguments is invalid.
    *
    *  @return A pointer to the start of the NUL-terminated demangled
-   *  name, or NULL if the demangling fails.  The caller is
+   *  name, or a null pointer if the demangling fails.  The caller is
    *  responsible for deallocating this memory using @c free.
    *
    *  The demangling is performed using the C++ ABI mangling rules,