Commit Message

From: Peter Bennett <pbennett@mythtv.org>
The header stdatomic.h causes compile errors in a c++ compiler, even
when extern "C" is used around it. The appropriate c++ include is <atomic>.
We cannot use #include <atomic> inside error_resilience.h because that causes
compile errors inside extern "C". With this change, using error_resilience.h in a
c++ program works but requires also including <atomic> in the c++ code.
---
libavcodec/error_resilience.h | 2 ++
1 file changed, 2 insertions(+)

Comments

On 5/15/2018 9:25 PM, Peter Bennett wrote:
> From: Peter Bennett <pbennett@mythtv.org>> > The header stdatomic.h causes compile errors in a c++ compiler, even> when extern "C" is used around it. The appropriate c++ include is <atomic>.> We cannot use #include <atomic> inside error_resilience.h because that causes> compile errors inside extern "C". With this change, using error_resilience.h in a> c++ program works but requires also including <atomic> in the c++ code.
This is not a public header, so you're not supposed to have it available
or be able to include it at all from any external program.
> ---> libavcodec/error_resilience.h | 2 ++> 1 file changed, 2 insertions(+)> > diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h> index 664a765..7d81c4d 100644> --- a/libavcodec/error_resilience.h> +++ b/libavcodec/error_resilience.h> @@ -20,7 +20,9 @@> #define AVCODEC_ERROR_RESILIENCE_H> > #include <stdint.h>> +#ifndef __cplusplus> #include <stdatomic.h>> +#endif> > #include "avcodec.h"> #include "me_cmp.h">

2018-05-16 2:25 GMT+02:00, Peter Bennett <pb.mythtv@gmail.com>:
> From: Peter Bennett <pbennett@mythtv.org>>> The header stdatomic.h causes compile errors in a c++ compiler, even> when extern "C" is used around it. The appropriate c++ include is <atomic>.> We cannot use #include <atomic> inside error_resilience.h because that> causes> compile errors inside extern "C". With this change, using error_resilience.h> in a> c++ program works but requires also including <atomic> in the c++ code.> ---> libavcodec/error_resilience.h
This is not an installed header, it must never be included from
c++ code.
Carl Eugen

On 05/15/2018 08:44 PM, James Almer wrote:
> On 5/15/2018 9:25 PM, Peter Bennett wrote:>> From: Peter Bennett <pbennett@mythtv.org>>>>> The header stdatomic.h causes compile errors in a c++ compiler, even>> when extern "C" is used around it. The appropriate c++ include is <atomic>.>> We cannot use #include <atomic> inside error_resilience.h because that causes>> compile errors inside extern "C". With this change, using error_resilience.h in a>> c++ program works but requires also including <atomic> in the c++ code.> This is not a public header, so you're not supposed to have it available> or be able to include it at all from any external program.>
We use #include "libavcodec/mpegvideo.h"
That file does an include for error_resilience.h, and this breaks our
compile.
Is libavcodec/mpegvideo.h also a file we should not include?
>> --->> libavcodec/error_resilience.h | 2 ++>> 1 file changed, 2 insertions(+)>>>> diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h>> index 664a765..7d81c4d 100644>> --- a/libavcodec/error_resilience.h>> +++ b/libavcodec/error_resilience.h>> @@ -20,7 +20,9 @@>> #define AVCODEC_ERROR_RESILIENCE_H>> >> #include <stdint.h>>> +#ifndef __cplusplus>> #include <stdatomic.h>>> +#endif>> >> #include "avcodec.h">> #include "me_cmp.h">>> _______________________________________________> ffmpeg-devel mailing list> ffmpeg-devel@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

On 5/15/2018 9:49 PM, Peter Bennett wrote:
> > > On 05/15/2018 08:44 PM, James Almer wrote:>> On 5/15/2018 9:25 PM, Peter Bennett wrote:>>> From: Peter Bennett <pbennett@mythtv.org>>>>>>> The header stdatomic.h causes compile errors in a c++ compiler, even>>> when extern "C" is used around it. The appropriate c++ include is>>> <atomic>.>>> We cannot use #include <atomic> inside error_resilience.h because>>> that causes>>> compile errors inside extern "C". With this change, using>>> error_resilience.h in a>>> c++ program works but requires also including <atomic> in the c++ code.>> This is not a public header, so you're not supposed to have it available>> or be able to include it at all from any external program.>>> We use #include "libavcodec/mpegvideo.h"> That file does an include for error_resilience.h, and this breaks our> compile.> Is libavcodec/mpegvideo.h also a file we should not include?
Correct. You're evidently using the entire ffmpeg source tree as part of
your application's build system, and trying to use internal headers
instead of the public ffmpeg headers that get installed in a normal system.
That kind of usage is unsupported, and of course any patch related to it
will not be accepted.
>>> --->>> libavcodec/error_resilience.h | 2 ++>>> 1 file changed, 2 insertions(+)>>>>>> diff --git a/libavcodec/error_resilience.h>>> b/libavcodec/error_resilience.h>>> index 664a765..7d81c4d 100644>>> --- a/libavcodec/error_resilience.h>>> +++ b/libavcodec/error_resilience.h>>> @@ -20,7 +20,9 @@>>> #define AVCODEC_ERROR_RESILIENCE_H>>> #include <stdint.h>>>> +#ifndef __cplusplus>>> #include <stdatomic.h>>>> +#endif>>> #include "avcodec.h">>> #include "me_cmp.h">>>>> _______________________________________________>> ffmpeg-devel mailing list>> ffmpeg-devel@ffmpeg.org>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel> > _______________________________________________> ffmpeg-devel mailing list> ffmpeg-devel@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

On 05/15/2018 08:58 PM, James Almer wrote:
> On 5/15/2018 9:49 PM, Peter Bennett wrote:>>>> On 05/15/2018 08:44 PM, James Almer wrote:>>> On 5/15/2018 9:25 PM, Peter Bennett wrote:>>>> From: Peter Bennett <pbennett@mythtv.org>>>>>>>>> The header stdatomic.h causes compile errors in a c++ compiler, even>>>> when extern "C" is used around it. The appropriate c++ include is>>>> <atomic>.>>>> We cannot use #include <atomic> inside error_resilience.h because>>>> that causes>>>> compile errors inside extern "C". With this change, using>>>> error_resilience.h in a>>>> c++ program works but requires also including <atomic> in the c++ code.>>> This is not a public header, so you're not supposed to have it available>>> or be able to include it at all from any external program.>>>>> We use #include "libavcodec/mpegvideo.h">> That file does an include for error_resilience.h, and this breaks our>> compile.>> Is libavcodec/mpegvideo.h also a file we should not include?> Correct. You're evidently using the entire ffmpeg source tree as part of> your application's build system, and trying to use internal headers> instead of the public ffmpeg headers that get installed in a normal system.>> That kind of usage is unsupported, and of course any patch related to it> will not be accepted.
Thanks for the info. You are right, that is what MythTV has done for
years. I am not sure why we are using this, but I will see what I can do
to can get away from these practices and use the public header files and
public API.
>>>>> --->>>> libavcodec/error_resilience.h | 2 ++>>>> 1 file changed, 2 insertions(+)>>>>>>>> diff --git a/libavcodec/error_resilience.h>>>> b/libavcodec/error_resilience.h>>>> index 664a765..7d81c4d 100644>>>> --- a/libavcodec/error_resilience.h>>>> +++ b/libavcodec/error_resilience.h>>>> @@ -20,7 +20,9 @@>>>> #define AVCODEC_ERROR_RESILIENCE_H>>>> #include <stdint.h>>>>> +#ifndef __cplusplus>>>> #include <stdatomic.h>>>>> +#endif>>>> #include "avcodec.h">>>> #include "me_cmp.h">>>>>>> _______________________________________________>>> ffmpeg-devel mailing list>>> ffmpeg-devel@ffmpeg.org>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>> _______________________________________________>> ffmpeg-devel mailing list>> ffmpeg-devel@ffmpeg.org>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel> _______________________________________________> ffmpeg-devel mailing list> ffmpeg-devel@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel