From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AD215470F1 for ; Sat, 26 Aug 2023 18:54:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C6E7768C514; Sat, 26 Aug 2023 21:54:43 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C984868B19A for ; Sat, 26 Aug 2023 21:54:36 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 872A524018E for ; Sat, 26 Aug 2023 20:54:36 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id X4wSHp7En5SV for ; Sat, 26 Aug 2023 20:54:35 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C2331240177 for ; Sat, 26 Aug 2023 20:54:35 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id AF6811601B9; Sat, 26 Aug 2023 20:54:35 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CAS8P250MB0744EA38BED5AB99ADD4A6568FE2A=40AS8P250M?= =?utf-8?q?B0744=2EEURP250=2EPROD=2EOUTLOOK=2ECOM=3E?= References: <20230826180748.15977-1-anton@khirnov.net> <20230826180748.15977-4-anton@khirnov.net> =?utf-8?q?=3CAS8P250MB0744EA38BE?= =?utf-8?q?D5AB99ADD4A6568FE2A=40AS8P250MB0744=2EEURP250=2EPROD=2EOUTLOOK=2E?= =?utf-8?q?COM=3E?= Mail-Followup-To: FFmpeg development discussions and patches Date: Sat, 26 Aug 2023 20:54:35 +0200 Message-ID: <169307607569.20400.17835042839885712913@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 4/6] doc/developer: add a code behaviour section to development policy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Andreas Rheinhardt (2023-08-26 20:36:25) > Anton Khirnov: > > Document our longstanding de facto policies on things like correctness, > > thread-safety, UB, etc. > > --- > > doc/developer.texi | 50 +++++++++++++++++++++++++++++++++------------- > > 1 file changed, 36 insertions(+), 14 deletions(-) > > > > diff --git a/doc/developer.texi b/doc/developer.texi > > index df43119f98..afa0148137 100644 > > --- a/doc/developer.texi > > +++ b/doc/developer.texi > > @@ -274,10 +274,6 @@ symbols. If in doubt, just avoid names starting with @code{_} altogether. > > @section Miscellaneous conventions > > > > @itemize @bullet > > -@item > > -fprintf and printf are forbidden in libavformat and libavcodec, > > -please use av_log() instead. > > - > > @item > > Casts should be used only when necessary. Unneeded parentheses > > should also be avoided if they don't make the code easier to understand. > > @@ -286,6 +282,42 @@ should also be avoided if they don't make the code easier to understand. > > @anchor{Development Policy} > > @chapter Development Policy > > > > +@section Code behaviour > > + > > +@subheading Correctness > > +The code must be valid. It must not crash, abort, access invalid pointers, leak > > +memory, cause data races or signed integer overflow, or otherwise invoke > > +undefined behaviour. Error codes should be checked and, when applicable, > > +forwarded to the caller. > > + > > +@subheading Thread- and library-safety > > +Our libraries may be called by multiple independent callers in the same process. > > +These calls may happen from any number of threads and the different call sites > > +may not be aware of each other - e.g. a user program may be calling us directly, > > +and use one or more libraries that also call us. The code must behave correctly > > +under such conditions. > > Some of this can no longer be guaranteed when FFmpeg is built without > threading support, but called from multiple threads concurrently. Should > this be mentioned or would it just confuse readers? (I'm leaning to the > latter.) I tend to agree, it's a very obscure use case anyway. But we should probably document more explicitly somewhere (and warn in configure) what building without threads actually implies. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".