This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, committed] Fix gcc_jit_context_get_last_error docs


gcc_jit_context_get_last_error was documented as returning a string that's
valid for the rest of the lifetime of the context.  In fact, the buffer
becomes invalid if any other errors occur on the context.

Fix the docs and header file comments to reflect this.
Also, fix a couple of other minor jit documentation issues.

Committed to trunk as r220145.

gcc/jit/ChangeLog:
	* docs/topics/compilation.rst (gcc_jit_result_get_code): Fix typo.
	* docs/topics/contexts.rst (gcc_jit_context_get_last_error): The
	error buffer is only valid until the next call to the context.
	* libgccjit.h (gcc_jit_context_get_first_error): Reword the
	comment to omit mention of compiling.
	(gcc_jit_context_get_last_error): The error buffer is only valid
	until the next call to the context.
---
 gcc/jit/docs/topics/compilation.rst |  2 +-
 gcc/jit/docs/topics/contexts.rst    |  6 +++---
 gcc/jit/libgccjit.h                 | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/jit/docs/topics/compilation.rst b/gcc/jit/docs/topics/compilation.rst
index bf59cc2..708d009 100644
--- a/gcc/jit/docs/topics/compilation.rst
+++ b/gcc/jit/docs/topics/compilation.rst
@@ -45,7 +45,7 @@ In-memory compilation
 
   A `gcc_jit_result` encapsulates the result of compiling a context
   in-memory, and the lifetimes of any machine code functions or globals
-  that are within the resuilt.
+  that are within the result.
 
 .. function:: void *\
               gcc_jit_result_get_code (gcc_jit_result *result,\
diff --git a/gcc/jit/docs/topics/contexts.rst b/gcc/jit/docs/topics/contexts.rst
index 0d81f1e..cc52077 100644
--- a/gcc/jit/docs/topics/contexts.rst
+++ b/gcc/jit/docs/topics/contexts.rst
@@ -146,11 +146,11 @@ occurred on the context, so that you can embed this in an exception:
 
    Returns the last error message that occurred on the context.
 
-   The returned string is valid for the rest of the lifetime of the
-   context.
-
    If no errors occurred, this will be NULL.
 
+   If non-NULL, the returned string is only guaranteed to be valid until
+   the next call to libgccjit relating to this context.
+
 Debugging
 ---------
 
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
index 12514ba..8f4354e 100644
--- a/gcc/jit/libgccjit.h
+++ b/gcc/jit/libgccjit.h
@@ -305,7 +305,7 @@ gcc_jit_context_set_logfile (gcc_jit_context *ctxt,
 			     int flags,
 			     int verbosity);
 
-/* To be called after a compile, this gives the first error message
+/* To be called after any API call, this gives the first error message
    that occurred on the context.
 
    The returned string is valid for the rest of the lifetime of the
@@ -315,13 +315,13 @@ gcc_jit_context_set_logfile (gcc_jit_context *ctxt,
 extern const char *
 gcc_jit_context_get_first_error (gcc_jit_context *ctxt);
 
-/* To be called after a compile, this gives the last error message
+/* To be called after any API call, this gives the last error message
    that occurred on the context.
 
-   The returned string is valid for the rest of the lifetime of the
-   context.
+   If no errors occurred, this will be NULL.
 
-   If no errors occurred, this will be NULL.  */
+   If non-NULL, the returned string is only guaranteed to be valid until
+   the next call to libgccjit relating to this context. */
 extern const char *
 gcc_jit_context_get_last_error (gcc_jit_context *ctxt);
 
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]