From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Introducing 'safety' compilation parameter Date: Tue, 07 May 2024 06:37:50 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21966"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , monnier@iro.umontreal.ca, mattias.engdegard@gmail.com, stefankangas@gmail.com To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 12:38:43 2024 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 1s4IDa-0005TS-J1 for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 12:38:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4ICx-0004Dz-0q; Tue, 07 May 2024 06:38:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4ICu-0004DU-2p for emacs-devel@gnu.org; Tue, 07 May 2024 06:38:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4ICs-0002g5-Sx; Tue, 07 May 2024 06:37:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=11RlQVxpwb/PmsOVIhVpMtu08efVW2upa+6IH1OfdZI=; b=Rt4ucr8IFrlbmv anzhQH9ao4Cluhl311YKDqsfcaNt+sKGUDyUa848uag4igPBIxTlLL/Va7ti0K5qaabpV2vTPTPXo sEeAUoN5n0jw8IIYuqp4zBZoYDTJG46WZ7DxPiZNqpEF+raDwAukhkjOLlXINFyEnEUqyZyjVCC7F bBP/t6LnKzw3NL8oxklRzAuOo7Qrtlmk1r7pVXs/Umr7hFp2DDYnF/tEgdFjP1LJDuFNAI2yPgd0l XhSSPedJOu45NC0JFzVVAgp34/NgWvvtrGIWtxuUNuMp83fdKulMxstfRT7sqXEiO6rg5JCcWKPWB oCYbpwSKfO5xoIcr17Cg==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1s4ICk-0000lj-Cf; Tue, 07 May 2024 06:37:52 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318932 Archived-At: Hello, I've put in scratch/comp-safety a branch wich introduces 'safety' as compilation parameter. 'safety' can be used similarly to 'native-comp-speed' both as a global variable to influence compilation both as a function declaration. 'safety' justification of existence is ATM being able to control the undefined behaviour being created when function type declaration added by the user is not correct. ATM we can have two values: 1 Emitted code is generated in a safe matter even if function types are miss-declared. 0 Emitted code can misbehave or crash Emacs if function declarations are not correct and the function is native compiled (@pxref{Native Compilation}). 1 is ATM the default. I didn't want to give safety a prefix (byte- or comp-) as I believe we should extend safety in the future with a value to have the byte compiler generates runtime type checks to verify the declred types. OTOH this is creating a warning for a missing prefix, not sure what's the best way to fix this (give it a prefix or silence the compiler if possible). Also I added some doc for the declaration, but didn't kwnow where in the manual the documention for the variable should go as now it has effect only for the native compiler. Should I document it under "Native-Compilation Variables" for now? Thanks Andrea