From patchwork Mon Apr 17 00:20:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Levinson X-Patchwork-Id: 3434 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp1066675vsd; Sun, 16 Apr 2017 17:20:14 -0700 (PDT) X-Received: by 10.28.55.3 with SMTP id e3mr7145680wma.15.1492388414377; Sun, 16 Apr 2017 17:20:14 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c19si13733958wre.200.2017.04.16.17.20.13; Sun, 16 Apr 2017 17:20:14 -0700 (PDT) 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 E7866688329; Mon, 17 Apr 2017 03:20:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from white.spiritone.com (white.spiritone.com [216.99.193.38]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DFF606808D1 for ; Mon, 17 Apr 2017 03:19:57 +0300 (EEST) Received: from [192.168.3.100] (184-100-162-109.ptld.qwest.net [184.100.162.109]) by white.spiritone.com (Postfix) with ESMTPSA id B6C99734050B for ; Sun, 16 Apr 2017 17:20:04 -0700 (PDT) To: FFmpeg development discussions and patches From: Aaron Levinson Message-ID: <9faab0ce-29d5-0f04-59e1-bcaea04abeb4@aracnet.com> Date: Sun, 16 Apr 2017 17:20:02 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From 9e6a9e2b8d58f17c661a3f455e03c95587ec7b18 Mon Sep 17 00:00:00 2001 From: Aaron Levinson Date: Sun, 16 Apr 2017 17:13:31 -0700 Subject: [PATCH] libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1 Purpose: libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1. This is only relevant when thread.h is included by C++ files. In this case, the relevant code is only defined if HAVE_PTHREADS is defined as 1. Use configure --assert-level=2 to do so. Note: Issue discovered as a result of Coverity build failure. Cause of build failure pinpointed by Hendrik Leppkes. Comments: -- libavutil/thread.h: Altered ASSERT_PTHREAD_NORET definition such that it uses av_make_error_string instead of av_err2str(). av_err2str() uses a "parenthesized type followed by an initializer list", which is apparently not valid C++. This issue started occurring because thread.h is now included by the DeckLink C++ files. The alteration does the equivalent of what av_err2str() does, but instead declares the character buffer as a local variable. --- libavutil/thread.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavutil/thread.h b/libavutil/thread.h index 6e57447..f108e20 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -36,8 +36,11 @@ #define ASSERT_PTHREAD_NORET(func, ...) do { \ int ret = func(__VA_ARGS__); \ if (ret) { \ + char errbuf[AV_ERROR_MAX_STRING_SIZE] = ""; \ av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \ - " failed with error: %s\n", av_err2str(AVERROR(ret))); \ + " failed with error: %s\n", \ + av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, \ + AVERROR(ret))); \ abort(); \ } \ } while (0)