On Wed, 2026-05-13 at 10:16 +0200, Arsen Arsenović wrote: > Basile STARYNKEVITCH <[email protected]> writes: > > > Yes, and I suggest improving the libgccjit documentation by > > mentioning > > it (I mean both calls to gcc_jit_context_add_command_line_option > > above) as an example. > > The documentation shows that in an example and refers to options in > the > singular: "Add an arbitrary gcc command-line option to the context". > > See > https://gcc.gnu.org/onlinedocs/jit/topics/contexts.html#c.gcc_jit_context_add_command_line_option
True, but I think there's room for improvement. I'm attaching a patch with a proposed clarification. Hope this wording is clearer. Dave
From a9eb3f7b16fd83276409105fb721c62c2c899763 Mon Sep 17 00:00:00 2001 From: David Malcolm <[email protected]> Date: Wed, 13 May 2026 10:15:10 -0400 Subject: [PATCH] jit: clarify docs for gcc_jit_context_add_{command_line,driver}_option gcc/jit/ChangeLog: * docs/topics/contexts.rst (gcc_jit_context_add_command_line_option): Clarify that adding multiple options requires multiple calls. (gcc_jit_context_add_driver_option): Likewise. Signed-off-by: David Malcolm <[email protected]> --- gcc/jit/docs/topics/contexts.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/jit/docs/topics/contexts.rst b/gcc/jit/docs/topics/contexts.rst index 6792f7b042c..7b17780667b 100644 --- a/gcc/jit/docs/topics/contexts.rst +++ b/gcc/jit/docs/topics/contexts.rst @@ -557,10 +557,13 @@ Additional command-line options by :func:`gcc_jit_context_compile` and :func:`gcc_jit_context_compile_to_file`. + If you need to add more than one such option, each should be done via + its own call to `gcc_jit_context_add_command_line_option`. + The parameter ``optname`` must be non-NULL. The underlying buffer is copied, so that it does not need to outlive the call. - Extra options added by `gcc_jit_context_add_command_line_option` are + Extra options added by calls to `gcc_jit_context_add_command_line_option` are applied *after* the regular options above, potentially overriding them. Options from parent contexts are inherited by child contexts; options from the parent are applied *before* those from the child. @@ -593,7 +596,10 @@ Additional command-line options The parameter ``optname`` must be non-NULL. The underlying buffer is copied, so that it does not need to outlive the call. - Extra options added by `gcc_jit_context_add_driver_option` are + If you need to add more than one such option, each should be done via + its own call to `gcc_jit_context_add_driver_option`. + + Extra options added by calls to `gcc_jit_context_add_driver_option` are applied *after* all other options potentially overriding them. Options from parent contexts are inherited by child contexts; options from the parent are applied *before* those from the child. -- 2.49.0
