aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormarxin <mliska@suse.cz>2022-07-25 11:15:25 +0200
committerMartin Liska <mliska@suse.cz>2022-07-28 12:37:03 +0200
commita8a282d5202f3e3305bd5f4b40adc0ce743c9b98 (patch)
treece48b0756ea290dcd88481868c9a4b1b960964ac /gcc
parent68c994f9aa8a60e69d080693f0cbef119ab65886 (diff)
downloadgcc-a8a282d5202f3e3305bd5f4b40adc0ce743c9b98.zip
gcc-a8a282d5202f3e3305bd5f4b40adc0ce743c9b98.tar.gz
gcc-a8a282d5202f3e3305bd5f4b40adc0ce743c9b98.tar.bz2
jit,docs: various fixes
gcc/jit/ChangeLog: * docs/cp/intro/tutorial02.rst: Use proper reference. * docs/cp/topics/contexts.rst: Likewise. * docs/cp/topics/functions.rst: Put `class` directive before a function as it is not allowed declaring a class in a fn. * docs/cp/topics/types.rst: Add template keyword. * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Add removed comment used for code snippet ending detection. * docs/intro/tutorial04.rst: Fix to match the real comment.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/jit/docs/cp/intro/tutorial02.rst2
-rw-r--r--gcc/jit/docs/cp/topics/contexts.rst2
-rw-r--r--gcc/jit/docs/cp/topics/functions.rst46
-rw-r--r--gcc/jit/docs/cp/topics/types.rst2
-rw-r--r--gcc/jit/docs/examples/tut04-toyvm/toyvm.c1
-rw-r--r--gcc/jit/docs/intro/tutorial04.rst2
6 files changed, 28 insertions, 27 deletions
diff --git a/gcc/jit/docs/cp/intro/tutorial02.rst b/gcc/jit/docs/cp/intro/tutorial02.rst
index 2064f8e..55675cc 100644
--- a/gcc/jit/docs/cp/intro/tutorial02.rst
+++ b/gcc/jit/docs/cp/intro/tutorial02.rst
@@ -121,7 +121,7 @@ in this case just one:
params.push_back (param_i);
Now we can create the function, using
-:c:func:`gccjit::context::new_function`:
+:cpp:func:`gccjit::context::new_function`:
.. code-block:: c++
diff --git a/gcc/jit/docs/cp/topics/contexts.rst b/gcc/jit/docs/cp/topics/contexts.rst
index e5bccfb..f60f210 100644
--- a/gcc/jit/docs/cp/topics/contexts.rst
+++ b/gcc/jit/docs/cp/topics/contexts.rst
@@ -141,7 +141,7 @@ Debugging
If "update_locations" is true, then also set up :class:`gccjit::location`
information throughout the context, pointing at the dump file as if it
were a source file. This may be of use in conjunction with
- :c:macro:`GCCJIT::BOOL_OPTION_DEBUGINFO` to allow stepping through the
+ :c:macro:`GCC_JIT_BOOL_OPTION_DEBUGINFO` to allow stepping through the
code in a debugger.
.. function:: void\
diff --git a/gcc/jit/docs/cp/topics/functions.rst b/gcc/jit/docs/cp/topics/functions.rst
index 0e266ab..4e325ac 100644
--- a/gcc/jit/docs/cp/topics/functions.rst
+++ b/gcc/jit/docs/cp/topics/functions.rst
@@ -243,6 +243,29 @@ Statements
return;
+.. class:: gccjit::case_
+
+ A `gccjit::case_` represents a case within a switch statement, and
+ is created within a particular :class:`gccjit::context` using
+ :func:`gccjit::context::new_case`. It is a subclass of
+ :class:`gccjit::object`.
+
+ Each case expresses a multivalued range of integer values. You
+ can express single-valued cases by passing in the same value for
+ both `min_value` and `max_value`.
+
+.. function:: gccjit::case_ *\
+ gccjit::context::new_case (gccjit::rvalue min_value,\
+ gccjit::rvalue max_value,\
+ gccjit::block dest_block)
+
+ Create a new gccjit::case for use in a switch statement.
+ `min_value` and `max_value` must be constants of an integer type,
+ which must match that of the expression of the switch statement.
+
+ `dest_block` must be within the same function as the switch
+ statement.
+
.. function:: void\
gccjit::block::end_with_switch (gccjit::rvalue expr,\
gccjit::block default_block,\
@@ -292,29 +315,6 @@ Statements
#ifdef LIBGCCJIT_HAVE_SWITCH_STATEMENTS
- .. class:: gccjit::case_
-
- A `gccjit::case_` represents a case within a switch statement, and
- is created within a particular :class:`gccjit::context` using
- :func:`gccjit::context::new_case`. It is a subclass of
- :class:`gccjit::object`.
-
- Each case expresses a multivalued range of integer values. You
- can express single-valued cases by passing in the same value for
- both `min_value` and `max_value`.
-
- .. function:: gccjit::case_ *\
- gccjit::context::new_case (gccjit::rvalue min_value,\
- gccjit::rvalue max_value,\
- gccjit::block dest_block)
-
- Create a new gccjit::case for use in a switch statement.
- `min_value` and `max_value` must be constants of an integer type,
- which must match that of the expression of the switch statement.
-
- `dest_block` must be within the same function as the switch
- statement.
-
Here's an example of creating a switch statement:
.. literalinclude:: ../../../../testsuite/jit.dg/test-switch.cc
diff --git a/gcc/jit/docs/cp/topics/types.rst b/gcc/jit/docs/cp/topics/types.rst
index c695ceb..5d50a39 100644
--- a/gcc/jit/docs/cp/topics/types.rst
+++ b/gcc/jit/docs/cp/topics/types.rst
@@ -65,7 +65,7 @@ Standard types
Access the integer type of the given size.
-.. function:: gccjit::type \
+.. function:: template<typename T> gccjit::type \
gccjit::context::get_int_type <T> ()
Access the given integer type. For example, you could map the
diff --git a/gcc/jit/docs/examples/tut04-toyvm/toyvm.c b/gcc/jit/docs/examples/tut04-toyvm/toyvm.c
index 8334b97..c2333f0 100644
--- a/gcc/jit/docs/examples/tut04-toyvm/toyvm.c
+++ b/gcc/jit/docs/examples/tut04-toyvm/toyvm.c
@@ -764,6 +764,7 @@ toyvm_function_compile (toyvm_function *fn)
toyvm_result->cf_code =
(toyvm_compiled_code)gcc_jit_result_get_code (jit_result,
funcname);
+ /* (this leaks "jit_result" and "funcname") */
free (funcname);
diff --git a/gcc/jit/docs/intro/tutorial04.rst b/gcc/jit/docs/intro/tutorial04.rst
index e1c47a0..8909887 100644
--- a/gcc/jit/docs/intro/tutorial04.rst
+++ b/gcc/jit/docs/intro/tutorial04.rst
@@ -308,7 +308,7 @@ We can now compile it, and extract machine code from the result:
.. literalinclude:: ../examples/tut04-toyvm/toyvm.c
:start-after: /* We've now finished populating the context. Compile it. */
- :end-before: /* (this leaks "result" and "funcname") */
+ :end-before: /* (this leaks "jit_result" and "funcname") */
:language: c
We can now run the result: