* [committed] libstdc++: Adjust uses of null pointer constants in docs
@ 2023-04-18 23:15 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-04-18 23:15 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested x86_64-linux. Pushed to trunk.
-- >8 --
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 | 8 +++-----
libstdc++-v3/doc/xml/manual/extensions.xml | 8 +++-----
libstdc++-v3/libsupc++/cxxabi.h | 4 ++--
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/libstdc++-v3/doc/html/manual/ext_demangling.html b/libstdc++-v3/doc/html/manual/ext_demangling.html
index 028ec71d8c8..1e7cdda8326 100644
--- a/libstdc++-v3/doc/html/manual/ext_demangling.html
+++ b/libstdc++-v3/doc/html/manual/ext_demangling.html
@@ -26,6 +26,7 @@
</p><pre class="programlisting">
#include <exception>
#include <iostream>
+#include <cstdlib>
#include <cxxabi.h>
struct empty { };
@@ -33,7 +34,6 @@ struct empty { };
template <typename T, int N>
struct bar { };
-
int main()
{
int status;
@@ -43,11 +43,9 @@ int main()
bar<empty,17> u;
const std::type_info &ti = typeid(u);
- realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
+ realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &status);
std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
- return 0;
+ std::free(realname);
}
</pre><p>
This prints
diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml
index 196b55d8347..daa98f5cba7 100644
--- a/libstdc++-v3/doc/xml/manual/extensions.xml
+++ b/libstdc++-v3/doc/xml/manual/extensions.xml
@@ -521,6 +521,7 @@ get_temporary_buffer(5, (int*)0);
<programlisting>
#include <exception>
#include <iostream>
+#include <cstdlib>
#include <cxxabi.h>
struct empty { };
@@ -528,7 +529,6 @@ struct empty { };
template <typename T, int N>
struct bar { };
-
int main()
{
int status;
@@ -538,11 +538,9 @@ int main()
bar<empty,17> u;
const std::type_info &ti = typeid(u);
- realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
+ realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &status);
std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
- return 0;
+ std::free(realname);
}
</programlisting>
<para>
diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h
index 10179bc0a0d..ac0637b0343 100644
--- a/libstdc++-v3/libsupc++/cxxabi.h
+++ b/libstdc++-v3/libsupc++/cxxabi.h
@@ -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,
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-18 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 23:15 [committed] libstdc++: Adjust uses of null pointer constants in docs 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).