public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libbacktrace PATCH: improve comment for backtrace_create_state
@ 2017-04-04 12:05 basile
  2017-04-04 13:38 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: basile @ 2017-04-04 12:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: iant

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

Hello All,

I just discovered that backtrace_create_state should be called once, 
that it is returning some heap-allocated data (which cannot be free-d, 
because there is no
backtrace_destroy_state routine).

I suggest the attached patch (against GCC trunk r246678) which just 
improves the comment describing that function.

libgcc/ChangeLog entry:

2017-04-04  Basile Starynkevitch  <basile@starynkevitch.net>

        * backtrace.h (backtrace_create_state): Improve comment, since 
should be called once.

Comments are welcome. Otherwise, ok for trunk?

-- 
Basile Starynkevitch (France)
http://starynkevitch.net/Basile/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-r246678-backtrace-comment.diff --]
[-- Type: text/x-diff; name=gcc-r246678-backtrace-comment.diff, Size: 1782 bytes --]

Index: libbacktrace/backtrace.h
===================================================================
--- libbacktrace/backtrace.h	(revision 246678)
+++ libbacktrace/backtrace.h	(working copy)
@@ -83,16 +83,17 @@
 					  int errnum);
 
 /* Create state information for the backtrace routines.  This must be
-   called before any of the other routines, and its return value must
-   be passed to all of the other routines.  FILENAME is the path name
-   of the executable file; if it is NULL the library will try
-   system-specific path names.  If not NULL, FILENAME must point to a
-   permanent buffer.  If THREADED is non-zero the state may be
-   accessed by multiple threads simultaneously, and the library will
-   use appropriate atomic operations.  If THREADED is zero the state
-   may only be accessed by one thread at a time.  This returns a state
-   pointer on success, NULL on error.  If an error occurs, this will
-   call the ERROR_CALLBACK routine.  */
+   called once before any of the other routines (probably at startup,
+   e.g. early in main), and its return value must be passed to all of
+   the other routines.  FILENAME is the path name of the executable
+   file; if it is NULL the library will try system-specific path
+   names.  If not NULL, FILENAME must point to a permanent buffer.  If
+   THREADED is non-zero the state may be accessed by multiple threads
+   simultaneously, and the library will use appropriate atomic
+   operations.  If THREADED is zero the state may only be accessed by
+   one thread at a time.  This returns a state pointer on success,
+   NULL on error.  If an error occurs, this will call the
+   ERROR_CALLBACK routine.  */
 
 extern struct backtrace_state *backtrace_create_state (
     const char *filename, int threaded,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-04 14:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 12:05 libbacktrace PATCH: improve comment for backtrace_create_state basile
2017-04-04 13:38 ` Ian Lance Taylor
2017-04-04 13:51   ` basile
2017-04-04 14:05     ` Ian Lance Taylor
2017-04-04 14:14       ` basile

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).