while trying to compile some C++-code with the current SVN head o gavl/gmerlin/gmerlin_avdecoder, i noticed that gavl.h is not C++ compliant (nor ISO C, for that matter).
the problem is, that an enum is used as a base type in a typedef, before the enum is actually declared: <gavl.h:103> typedef enum gavl_pixelformat_e gavl_pixelformat_t; /* skip to line:1813...: */ enum gavl_pixelformat_e { /* ... */ </gavl.h> it seems that you can get away with this in gcc, but g++ is more strict and throws an error: /usr/local/include/gavl/gavl.h:103:14: error: use of enum ‘gavl_pixelformat_e’ without previous declaration typedef enum gavl_pixelformat_e gavl_pixelformat_t; according to [1], the forward declaration of enums is forbidden in both "ISO C" and "C++". it would be great if this could be fixed. (attached is a naive fix, reordering two chunks) mgfadsr IOhannes [1] http://stackoverflow.com/questions/20150739/
Index: include/gavl/gavl.h =================================================================== --- include/gavl/gavl.h (revision 4695) +++ include/gavl/gavl.h (working copy) @@ -96,12 +96,6 @@ typedef struct gavl_video_format_s gavl_video_format_t; -/*! \ingroup video_format - *\brief Pixelformat - */ - -typedef enum gavl_pixelformat_e gavl_pixelformat_t; - /** \ingroup video_frame * \brief Packet sink * @@ -110,8 +104,6 @@ typedef struct gavl_video_frame_s gavl_video_frame_t; -#include <gavl/hw.h> // Needs forward declarations - /** \defgroup mt Multithreading * \brief Multithreading * @@ -1943,6 +1935,12 @@ }; /*! \ingroup video_format + *\brief Pixelformat + */ + +typedef enum gavl_pixelformat_e gavl_pixelformat_t; + +/*! \ingroup video_format * \brief Pixelformat for storing 1-dimensional integer data with 8 bits each */ #define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8 /*! \ingroup video_format @@ -2368,6 +2366,8 @@ GAVL_PUBLIC int gavl_interlace_mode_is_mixed(gavl_interlace_mode_t mode); +#include <gavl/hw.h> // Needs forward declarations + /* Video format structure */ /*! \ingroup video_format
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________ Gmerlin-general mailing list Gmerlin-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gmerlin-general