diff mbox

[FFmpeg-devel] Avoid corrupting diagnostic state with _Pragma changes.

Message ID CAPUDrweixauav6VN3PhYjr=39o2QMgZJq_4YFjV+CfEnPpW5xQ@mail.gmail.com
State New
Headers show

Commit Message

Dale Curtis Nov. 4, 2017, 12:13 a.m. UTC
The macros for ICC and MSVC correctly push and pop the diagnostic
state of the compiler when disabling deprecation warnings. The
ones for clang/gcc should do the same. Without this, if a blanket
deprecation warning is applied to the code base it'll be flipped
back on incorrectly with FF_ENABLE_DEPRECATION_WARNINGS.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>

Comments

Dale Curtis Nov. 13, 2017, 8:51 p.m. UTC | #1
Ping?

On Fri, Nov 3, 2017 at 5:13 PM, Dale Curtis <dalecurtis@chromium.org> wrote:

> The macros for ICC and MSVC correctly push and pop the diagnostic
> state of the compiler when disabling deprecation warnings. The
> ones for clang/gcc should do the same. Without this, if a blanket
> deprecation warning is applied to the code base it'll be flipped
> back on incorrectly with FF_ENABLE_DEPRECATION_WARNINGS.
>
> Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
>
>
>
Michael Niedermayer Nov. 14, 2017, 7:59 p.m. UTC | #2
On Fri, Nov 03, 2017 at 05:13:58PM -0700, Dale Curtis wrote:
> The macros for ICC and MSVC correctly push and pop the diagnostic
> state of the compiler when disabling deprecation warnings. The
> ones for clang/gcc should do the same. Without this, if a blanket
> deprecation warning is applied to the code base it'll be flipped
> back on incorrectly with FF_ENABLE_DEPRECATION_WARNINGS.
> 
> Signed-off-by: Dale Curtis <dalecurtis@chromium.org>

>  internal.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> ecc5e46d6354c52e1a6df9813d446e5f58a93321  fix_pragma.patch
> From 73a488e07a328d05aa2b507a551b0c1e4b8a81c8 Mon Sep 17 00:00:00 2001
> From: Dale Curtis <dalecurtis@chromium.org>
> Date: Fri, 3 Nov 2017 17:10:55 -0700
> Subject: [PATCH] Avoid corrupting diagnostic state with _Pragma changes.
> 
> The macros for ICC and MSVC correctly push and pop the diagnostic
> state of the compiler when disabling deprecation warnings. The
> ones for clang/gcc should do the same. Without this, if a blanket
> deprecation warning is applied to the code base it'll be flipped
> back on incorrectly with FF_ENABLE_DEPRECATION_WARNINGS.
> 
> Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
> ---
>  libavutil/internal.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

thanks

[...]
diff mbox

Patch

From 73a488e07a328d05aa2b507a551b0c1e4b8a81c8 Mon Sep 17 00:00:00 2001
From: Dale Curtis <dalecurtis@chromium.org>
Date: Fri, 3 Nov 2017 17:10:55 -0700
Subject: [PATCH] Avoid corrupting diagnostic state with _Pragma changes.

The macros for ICC and MSVC correctly push and pop the diagnostic
state of the compiler when disabling deprecation warnings. The
ones for clang/gcc should do the same. Without this, if a blanket
deprecation warning is applied to the code base it'll be flipped
back on incorrectly with FF_ENABLE_DEPRECATION_WARNINGS.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
---
 libavutil/internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 6f92f71e8e..3e6c54e58a 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -77,8 +77,8 @@ 
 #        define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
 #        define FF_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
 #    else
-#        define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-#        define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
+#        define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#        define FF_ENABLE_DEPRECATION_WARNINGS  _Pragma("GCC diagnostic pop")
 #    endif
 #else
 #    define FF_DISABLE_DEPRECATION_WARNINGS
-- 
2.15.0.403.gc27cc4dac6-goog