From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Native compiler - passing command line options to C compiler Date: Tue, 31 Aug 2021 08:06:45 +0000 Message-ID: References: <83bl5fkvky.fsf@gnu.org> <83v93njc3x.fsf@gnu.org> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19223"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 31 10:07:27 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKynn-0004lq-Kb for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 10:07:27 +0200 Original-Received: from localhost ([::1]:45150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKynm-00083Y-Dl for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 04:07:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKynD-0007NW-E7 for emacs-devel@gnu.org; Tue, 31 Aug 2021 04:06:51 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:61278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKynB-0005ez-0y; Tue, 31 Aug 2021 04:06:51 -0400 Original-Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 17V86jMi023819 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Tue, 31 Aug 2021 08:06:46 GMT In-Reply-To: (Arthur Miller's message of "Tue, 31 Aug 2021 07:36:47 +0200") Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:273571 Archived-At: Arthur Miller 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 > 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