From patchwork Wed Feb 22 18:16:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 2644 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp1004971vsf; Wed, 22 Feb 2017 10:17:11 -0800 (PST) X-Received: by 10.28.181.145 with SMTP id e139mr3357911wmf.127.1487787431825; Wed, 22 Feb 2017 10:17:11 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 5si2666748wrf.191.2017.02.22.10.17.11; Wed, 22 Feb 2017 10:17:11 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A66D6688337; Wed, 22 Feb 2017 20:17:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E10E668828B for ; Wed, 22 Feb 2017 20:16:54 +0200 (EET) Received: from [172.31.218.40] (helo=vie01a-dmta-pe04-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cgbTK-00048M-FX for ffmpeg-devel@ffmpeg.org; Wed, 22 Feb 2017 19:17:02 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cgbTE-0001MI-Up for ffmpeg-devel@ffmpeg.org; Wed, 22 Feb 2017 19:16:56 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id nuGn1u01b0S5wYM01uGoMC; Wed, 22 Feb 2017 19:16:48 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 22 Feb 2017 19:16:46 +0100 Message-Id: <20170222181647.12076-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH 1/2] avutil/internal: Add ff_elog() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This enables the extra error messages in case of DEBUG or high assrtion levels. High assertion levels imply slow checks in inner loops so any extra error should be insignificant. Is it preferred to have a separate switch for ff_elog() so it doesnt depend on DEBUG/assertion level ? Signed-off-by: Michael Niedermayer --- libavutil/internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavutil/internal.h b/libavutil/internal.h index 7780a9a791..208f8f474f 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -262,6 +262,12 @@ void avpriv_request_sample(void *avc, # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif +#if defined(DEBUG) || ASSERT_LEVEL > 1 +# define ff_elog(ctx, ...) av_log(ctx, AV_LOG_ERROR, __VA_ARGS__) +#else +# define ff_elog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_ERROR, __VA_ARGS__); } while (0) +#endif + // For debuging we use signed operations so overflows can be detected (by ubsan) // For production we use unsigned so there are no undefined operations #ifdef CHECKED