options_table: Remove a now unnecessary include of config.h

Message ID 1478163539-10314-1-git-send-email-martin@martin.st
State Committed
Commit 1a469a5e423bdad779b8534247dea8cc86169b88
Headers show

Commit Message

Martin Storsjö Nov. 3, 2016, 8:58 a.m.
The include of config.h was added in 2012 in 1d9c2dc8, due to
the use of CONFIG_SHOW_ENCODER ifdefs within options_table.h.
When the snow codec was dropped later (in a0c5917f8 in 2013),
this include no longer served any purpose.

options_table.h is included in builds for the host as well, when
building documentation. config.h should not be included in code
that is built for the host, since it can contain workarounds
for the target compiler/environment, like adding a missing define
of restrict, defining getenv(x) to NULL for environments that lack
getenv.

The seemingly innocent include reordering in 2025d37871 broke
builds that have getenv(x) defined to NULL in config.h (Windows CE
and Windows Phone/RT), since libavcodec/options_table.h include
config.h, while libavformat/options_table.h end up bringing in
more system headers, and those system headers can contain a proper
definition of getenv, which clash with the getenv define in config.h.
This was avoided earlier as long as libavformat/options_table.h (or
avformat.h) was included before libavcodec/options_table.h.

This fixes builds for Windows Phone/RT and CE.
---
 libavcodec/options_table.h | 1 -
 1 file changed, 1 deletion(-)

Comments

Luca Barbato Nov. 3, 2016, 9:08 a.m. | #1
On 03/11/2016 09:58, Martin Storsjö wrote:
> The include of config.h was added in 2012 in 1d9c2dc8, due to
> the use of CONFIG_SHOW_ENCODER ifdefs within options_table.h.
> When the snow codec was dropped later (in a0c5917f8 in 2013),
> this include no longer served any purpose.

Ok with s/SHOW/SNOW/ I guess.

lu
Martin Storsjö Nov. 3, 2016, 9:12 a.m. | #2
On Thu, 3 Nov 2016, Martin Storsjö wrote:

> The include of config.h was added in 2012 in 1d9c2dc8, due to
> the use of CONFIG_SHOW_ENCODER ifdefs within options_table.h.

CONFIG_SNOW_ENCODER, of course. Amended locally.

// Martin

Patch

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 04cb20d..b1f9a92 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -26,7 +26,6 @@ 
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "version.h"
-#include "config.h"
 
 #define OFFSET(x) offsetof(AVCodecContext,x)
 #define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C