From patchwork Sat Apr 15 02:07:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Levinson X-Patchwork-Id: 3423 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp452481vsd; Fri, 14 Apr 2017 19:07:47 -0700 (PDT) X-Received: by 10.28.30.19 with SMTP id e19mr895848wme.52.1492222067199; Fri, 14 Apr 2017 19:07:47 -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 g4si5504097wrd.178.2017.04.14.19.07.46; Fri, 14 Apr 2017 19:07:47 -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 063C26891E2; Sat, 15 Apr 2017 05:07:37 +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 DB4A4680469 for ; Sat, 15 Apr 2017 05:07:29 +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 33DAC73402D8 for ; Fri, 14 Apr 2017 19:07:35 -0700 (PDT) References: <06436432-eeb4-c5ee-b209-b2d95bcb024c@aracnet.com> To: FFmpeg development discussions and patches From: Aaron Levinson Message-ID: <96183910-16da-948c-499e-708fa156a8cc@aracnet.com> Date: Fri, 14 Apr 2017 19:07:33 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <06436432-eeb4-c5ee-b209-b2d95bcb024c@aracnet.com> Subject: Re: [FFmpeg-devel] [PATCH] Enhanced configure to improve compiler options associated with debugging with Visual C++ (MSVC) 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" On 4/13/2017 5:03 PM, Aaron Levinson wrote: > From 558b957eb85a669899750b2e150eba7cdee8dcd9 Mon Sep 17 00:00:00 2001 > From: Aaron Levinson > Date: Thu, 13 Apr 2017 16:46:59 -0700 > Subject: [PATCH] Enhanced configure to improve compiler options associated with debugging with Visual C++ (MSVC) > > Purpose: Enhanced configure to improve compiler options > associated with debugging with Visual C++ (MSVC) Please disregard the earlier version of the patch. I've included a new version below that eliminates -MTd from the command-line options, based on a discussion that I had on IRC with Hendrik Leppkes. Thanks, Aaron Levinson --------------------------------------------------------------------------------------- From 4e78a20cf811d87f7a16715f3f9f3553a0d56ce3 Mon Sep 17 00:00:00 2001 From: Aaron Levinson Date: Fri, 14 Apr 2017 18:59:46 -0700 Subject: [PATCH] Enhanced configure to improve compiler options associated with debugging with Visual C++ (MSVC) Purpose: Enhanced configure to improve compiler options associated with debugging with Visual C++ (MSVC) Comments: -- configure: a) In msvc_common_flags() function, replaced the use of -Z7 with -Zi. Effectively, there was no point to using -Z7 anymore given than -debug is passed to the linker already (per the line "enabled debug && add_ldflags -debug" elsewhere in the file), which causes a .pdb to be generated anyway. -Z7 causes Codeview debug info to be placed in .obj files, while -Zi causes debug info to be placed in .pdb files. As a result of switching from -Z7 to -Zi, this may result in slightly faster builds with MSVC, since it is apparently slower to process Codeview debug info. b) In probe_cc() function, added _cflags_noopt declaration for MSVC. This is set to the following: "-Od -Og". See comments for more details. This is exposed when --disable-optimizations is used with configure. In addition, now adding -Zo (or -d2Zi+, depending on the compiler version) to all the different _cflags_ variables to make it easier to debug optimized builds. See changes and comments for further details. --- configure | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 1703111..c2d8b48 100755 --- a/configure +++ b/configure @@ -3844,7 +3844,7 @@ msvc_common_flags(){ -std=c99) ;; # Common flags -fomit-frame-pointer) ;; - -g) echo -Z7 ;; + -g) echo -Zi ;; -fno-math-errno) ;; -fno-common) ;; -fno-signed-zeros) ;; @@ -4153,6 +4153,33 @@ probe_cc(){ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' _cflags_speed="-O2" _cflags_size="-O1" + # Need to use -Og with -Od because otherwise has link issues with + # "if (ARCH_...)" code. Unfortunately, this isn't quite the same as + # a fully debug build. If the Dead Code Elimination (DCE) compiler + # optimization requirement is ever removed, this can be replaced + # with just -Od. Note that the use of -Og results in a compiler + # deprecation warning. + _cflags_noopt="-Od -Og" + cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p') + + # Make it easier to debug release builds. + # See https://msdn.microsoft.com/en-us/library/dn785163.aspx for more + # details. + # It may not be necessary to add -Zo to _cflags_noopt due to the use + # of -Od, but because -Og is also added currently, it is best to + # add -Zo for now to make sure the best debugging experience is + # possible. If the DCE compiler optimization requirement is ever + # removed, the _cflags_noopt lines can be removed. + if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then + _cflags_speed="${_cflags_speed} -Zo" + _cflags_size="${_cflags_size} -Zo" + _cflags_noopt="${_cflags_noopt} -Zo" + else + _cflags_speed="${_cflags_speed} -d2Zi+" + _cflags_size="${_cflags_size} -d2Zi+" + _cflags_noopt="${_cflags_noopt} -d2Zi+" + fi + if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' else