From: Andrea Corallo via "Emacs development discussions." <emacs-devel@gnu.org>
To: Arthur Miller <arthur.miller@live.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Native compiler - passing command line options to C compiler
Date: Tue, 31 Aug 2021 08:06:45 +0000 [thread overview]
Message-ID: <xjf5yvm2g2y.fsf@ma.sdf.org> (raw)
In-Reply-To: <AM9PR09MB4977B62F0BAA439E3DB6A53B96CC9@AM9PR09MB4977.eurprd09.prod.outlook.com> (Arthur Miller's message of "Tue, 31 Aug 2021 07:36:47 +0200")
Arthur Miller <arthur.miller@live.com> writes:
[...]
>>
>> AFAIR that was the reason for that check so yes.
>>
>> Andrea
>
> Ok, I have made those changes. I have removed double checks from both
> add_driver_options () and add_compiler_options (). If it is not OK, I can made
> another one and revert back this change in add_driver_options.
>
> I have also renamed native-comp-driver-options to native-comp-backend-options.
>
> I forgott to ask, which Changelog are we talking about? Changelo.3 in top Emacs
> dir or some other file?
>
>>From d0c2b4f882fc67562de6ad67f6dcfdfe6378c32b Mon Sep 17 00:00:00 2001
> From: Arthur Miller <arthur.miller@live.com>
> Date: Tue, 31 Aug 2021 07:15:01 +0200
> Subject: [PATCH] Native comp: gcc cmdopts + rename driver-options to
> backend-options.
>
> ---
> lisp/emacs-lisp/bytecomp.el | 4 +-
> lisp/emacs-lisp/comp.el | 36 ++++++++---
> src/comp.c | 122 ++++++++++++++++++++++++++----------
> 3 files changed, 118 insertions(+), 44 deletions(-)
>
[...]
> #pragma GCC diagnostic ignored "-Waddress"
> -DEFUN ("comp-native-driver-options-effective-p",
> - Fcomp_native_driver_options_effective_p,
> - Scomp_native_driver_options_effective_p,
> +DEFUN ("comp-native-backend-options-effective-p",
> + Fcomp_native_backend_options_effective_p,
> + Scomp_native_backend_options_effective_p,
> 0, 0, 0,
> - doc: /* Return t if `comp-native-driver-options' is effective. */)
> + doc: /* Return t if `comp-native-backend-options' is effective. */)
> (void)
> {
> #if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
> @@ -4377,43 +4378,95 @@ DEFUN ("comp-native-driver-options-effective-p",
> }
> #pragma GCC diagnostic pop
>
> +#pragma GCC diagnostic ignored "-Waddress"
> +DEFUN ("comp-native-compiler-options-effective-p",
> + Fcomp_native_compiler_options_effective_p,
> + Scomp_native_compiler_options_effective_p,
> + 0, 0, 0,
> + doc: /* Return t if `comp-native-compiler-options' is effective. */)
> + (void)
> +{
> +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option)
> + if (gcc_jit_context_add_command_line_option)
> + return Qt;
> +#endif
> + return Qnil;
> +}
> +#pragma GCC diagnostic pop
> +
> static void
> add_driver_options (void)
> {
> - Lisp_Object options = Fsymbol_value (Qnative_comp_driver_options);
> + Lisp_Object options = Fsymbol_value (Qnative_comp_backend_options);
>
> -#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
This is still necessary to have the code compatible with old libgccjit.
> - || defined (WINDOWSNT)
> - load_gccjit_if_necessary (true);
> - if (!NILP (Fcomp_native_driver_options_effective_p ()))
> + if (!NILP (Fcomp_native_backend_options_effective_p ()))
> + {
> + load_gccjit_if_necessary (true);
> + FOR_EACH_TAIL (options)
> + gcc_jit_context_add_driver_option (comp.ctxt,
> + /* FIXME: Need to encode
> + this, but how? either
> + ENCODE_FILE or
> + ENCODE_SYSTEM. */
> + SSDATA (XCAR (options)));
> + }
> +
> + if (CONSP (options))
> + xsignal1 (Qnative_compiler_error,
> + build_string ("Customizing native compiler options"
> + " via `comp-native-backend-options' is"
> + " only available on libgccjit version 9"
> + " and above."));
> +
> + /* Captured `comp-native-backend-options' because file-local. */
> + if (!NILP (Fcomp_native_backend_options_effective_p ()))
> + {
> + options = comp.backend_options;
> + FOR_EACH_TAIL (options)
> + gcc_jit_context_add_driver_option (comp.ctxt,
> + /* FIXME: Need to encode
> + this, but how? either
> + ENCODE_FILE or
> + ENCODE_SYSTEM. */
> + SSDATA (XCAR (options)));
> + }
> +}
> +
> +static void
> +add_compiler_options (void)
> +{
> + Lisp_Object options = Fsymbol_value (Qnative_comp_compiler_options);
> +
> + if (!NILP (Fcomp_native_compiler_options_effective_p ()))
> + {
> + load_gccjit_if_necessary (true);
> FOR_EACH_TAIL (options)
> - gcc_jit_context_add_driver_option (comp.ctxt,
> - /* FIXME: Need to encode
> - this, but how? either
> - ENCODE_FILE or
> - ENCODE_SYSTEM. */
> - SSDATA (XCAR (options)));
> -#endif
> + gcc_jit_context_add_command_line_option (comp.ctxt,
> + /* FIXME: Need to encode
> + this, but how? either
> + ENCODE_FILE or
> + ENCODE_SYSTEM. */
> + SSDATA (XCAR (options)));
> + }
> if (CONSP (options))
> xsignal1 (Qnative_compiler_error,
> build_string ("Customizing native compiler options"
> - " via `comp-native-driver-options' is"
> + " via `comp-native-compiler-options' is"
> " only available on libgccjit version 9"
> " and above."));
>
> - /* Captured `comp-native-driver-options' because file-local. */
> -#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
Same
TIA
Andrea
next prev parent reply other threads:[~2021-08-31 8:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AM9PR09MB49778CFA83AA6697D09ED01B96CA9@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-08-30 9:36 ` Native compiler - passing command line options to C compiler Andrea Corallo via Emacs development discussions.
2021-08-30 13:56 ` Arthur Miller
2021-08-30 14:05 ` Andrea Corallo via Emacs development discussions.
2021-08-30 11:42 ` Eli Zaretskii
2021-08-30 12:59 ` Andrea Corallo via Emacs development discussions.
2021-08-30 13:28 ` Eli Zaretskii
2021-08-30 14:28 ` Andrea Corallo via Emacs development discussions.
2021-08-30 15:00 ` Arthur Miller
2021-08-30 15:38 ` Andrea Corallo via Emacs development discussions.
2021-08-31 5:36 ` Arthur Miller
2021-08-31 8:06 ` Andrea Corallo via Emacs development discussions. [this message]
2021-08-31 13:01 ` Eli Zaretskii
2021-08-31 22:53 ` Arthur Miller
2021-09-01 11:45 ` Eli Zaretskii
2021-09-01 14:23 ` Arthur Miller
2021-09-01 16:45 ` Eli Zaretskii
2021-09-01 21:06 ` Arthur Miller
2021-08-30 16:01 ` Eli Zaretskii
2021-08-30 15:50 ` Eli Zaretskii
2021-08-30 14:01 ` Arthur Miller
2021-08-30 14:03 ` Eli Zaretskii
2021-09-01 14:58 ` Alex Bennée
2021-09-01 15:10 ` Perry E. Metzger
2021-09-01 16:04 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xjf5yvm2g2y.fsf@ma.sdf.org \
--to=emacs-devel@gnu.org \
--cc=akrl@sdf.org \
--cc=arthur.miller@live.com \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).