[vlc-devel] [PATCH 28/28] include/vlc_codecs.h: deprecation/fix of reserved identifiers

Filip Roséen filip at atch.se
Sat Feb 20 23:20:33 CET 2016


  * renamed include-guard since the old one was a reserved identifier

  * replaced comment at `#endif` corresponding to include-guard

  * Added preprocessor directives to issue a warning upon usage
    of identifiers that are reserved according to the ISO C Standard.

    These checks should be removed when we are confident that they are
    still not used in the codebase. From this on forward the following
    directives should be used (if ever);

    - `VLC__SKIP_WAVEFORMATEX` instead of `_WAVEFORMATEX_`
    - `VLC__SKIP_WAVEFORMATEXTENSIBLE` instead of `_WAVEFORMATEXTENSIBLE_`
    - `VLC__SKIP_WAVEHEADER` instead of `_WAVEHEADER_`
    - `VLC__SKIP_BITMAPINFOHEADER` instead of `_VLC_BITMAPINFOHEADER_`
    - `VLC__SKIP_RECT32` instead of `_RECT32_`
    - `VLC__SKIP_REFERENCE_TIME` instead of `_REFERENCE_TIME_`
    - `VLC__SKIP_VIDEOINFOHEADER` instead of `_VIDEOINFOHEADER_`
    - `VLC__SKIP_RGBQUAD` instead of `_RGBQUAD_`
    - `VLC__SKIP_TRUECOLORINFO` instead of `_TRUECOLORINFO_`
    - `VLC__SKIP_VIDEOINFO` instead of `_VIDEOINFO_`
---
 include/vlc_codecs.h | 116 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 90 insertions(+), 26 deletions(-)

diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index cdac8b6..aa9a530 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -21,8 +21,8 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef VLC_CODECS_H
-#define VLC_CODECS_H 1
+#ifndef VLC_CODECS_H_
+#define VLC_CODECS_H_
 
 #include <vlc_fourcc.h>
 /**
@@ -57,8 +57,15 @@ typedef GUID guid_t;
 #   error FIXME
 #endif
 
-#ifndef _WAVEFORMATEX_
-#define _WAVEFORMATEX_
+
+
+#ifndef VLC__SKIP_WAVEFORMATEX
+#define VLC__SKIP_WAVEFORMATEX
+#  ifdef _WAVEFORMATEX_
+#    warning "_WAVEFORMATEX_ is deprecated, use VLC__SKIP_WAVEFORMATEX"
+#  else
+#    define _WAVEFORMATEX_
+
 typedef struct
 ATTR_PACKED
 _WAVEFORMATEX {
@@ -70,10 +77,18 @@ _WAVEFORMATEX {
     uint16_t   wBitsPerSample;
     uint16_t   cbSize;
 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
-#endif /* _WAVEFORMATEX_ */
 
-#ifndef _WAVEFORMATEXTENSIBLE_
-#define _WAVEFORMATEXTENSIBLE_
+#  endif
+#endif
+
+
+
+#ifndef VLC__SKIP_WAVEFORMATEXTENSIBLE
+#define VLC__SKIP_WAVEFORMATEXTENSIBLE
+#  ifdef _WAVEFORMATEXTENSIBLE_
+#    warning "_WAVEFORMATEXTENSIBLE_ is deprecated, use VLC__SKIP_WAVEFORMATEXTENSIBLE"
+#  else
+#    define _WAVEFORMATEXTENSIBLE_
 typedef struct
 ATTR_PACKED
 _WAVEFORMATEXTENSIBLE {
@@ -88,10 +103,17 @@ _WAVEFORMATEXTENSIBLE {
 
     GUID SubFormat;
 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
-#endif /* _WAVEFORMATEXTENSIBLE_ */
+#  endif
+#endif
+
 
-#ifndef _WAVEHEADER_
-#define _WAVEHEADER_
+
+#ifndef VLC__SKIP_WAVEHEADER
+#define VLC__SKIP_WAVEHEADER
+#  ifdef _WAVEHEADER_
+#    warning "_WAVEHEADER_ is deprecated, use VLC__SKIP_WAVEHEADER"
+#  else
+#    define _WAVEHEADER_
 typedef struct
 ATTR_PACKED
 _WAVEHEADER {
@@ -109,11 +131,17 @@ _WAVEHEADER {
     uint32_t DataChunkID;
     uint32_t DataLength;
 } WAVEHEADER;
-#endif /* _WAVEHEADER_ */
+#  endif
+#endif
 
-#ifndef _VLC_BITMAPINFOHEADER_
-#define _VLC_BITMAPINFOHEADER_
 
+
+#ifndef VLC__SKIP_BITMAPINFOHEADER
+#define VLC__SKIP_BITMAPINFOHEADER
+#  ifdef _VLC_BITMAPINFOHEADER_
+#    warning "_VLC_BITMAPINFOHEADER_ is deprecated, use VLC__SKIP_BITMAPINFOHEADER"
+#  else
+#    define _VLC_BITMAPINFOHEADER_
 typedef struct
 ATTR_PACKED
 {
@@ -136,24 +164,44 @@ ATTR_PACKED
     VLC_BITMAPINFOHEADER bmiHeader;
     int                  bmiColors[1];
 } VLC_BITMAPINFO, *VLC_LPBITMAPINFO;
+#  endif
 #endif
 
-#ifndef _RECT32_
-#define _RECT32_
+
+#ifndef VLC__SKIP_RECT32
+#define VLC__SKIP_RECT32
+#  ifdef _RECT32_
+#    warning "_RECT32_ is deprecated, use VLC__SKIP_RECT32"
+#  else
+#    define _RECT32_
 typedef struct
 ATTR_PACKED
 {
     int left, top, right, bottom;
 } RECT32;
+#  endif
 #endif
 
-#ifndef _REFERENCE_TIME_
-#define _REFERENCE_TIME_
+
+
+#ifndef VLC__SKIP_REFERENCE_TIME
+#define VLC__SKIP_REFERENCE_TIME
+#  ifdef _REFERENCE_TIME
+#    warning "_REFERENCE_TIME is deprecated, use VLC__SKIP_REFERENCE_TIME"
+#  else
+#    define _REFERENCE_TIME
 typedef int64_t REFERENCE_TIME;
+#  endif
 #endif
 
-#ifndef _VIDEOINFOHEADER_
-#define _VIDEOINFOHEADER_
+
+
+#ifndef VLC__SKIP_VIDEOINFOHEADER
+#define VLC__SKIP_VIDEOINFOHEADER
+#  ifdef _VIDEOINFOHEADER_
+#    warning "_VIDEOINFOHEADER_ is deprecated, use VLC__SKIP_VIDEOINFOHEADER"
+#  else
+#    define _VIDEOINFOHEADER_
 typedef struct
 ATTR_PACKED
 {
@@ -164,10 +212,15 @@ ATTR_PACKED
     REFERENCE_TIME          AvgTimePerFrame;
     VLC_BITMAPINFOHEADER    bmiHeader;
 } VIDEOINFOHEADER;
+#  endif
 #endif
 
-#ifndef _RGBQUAD_
-#define _RGBQUAD_
+#ifndef VLC__SKIP_RGBQUAD
+#define VLC__SKIP_RGBQUAD
+#  ifdef _RGBQUAD_
+#    warning "_RGBQUAD_ is deprecated, use VLC__SKIP_RGBQUAD"
+#  else
+#    define _RGBQUAD_
 typedef struct
 ATTR_PACKED
 {
@@ -176,20 +229,30 @@ ATTR_PACKED
     uint8_t rgbRed;
     uint8_t rgbReserved;
 } RGBQUAD1;
+#  endif
 #endif
 
-#ifndef _TRUECOLORINFO_
-#define _TRUECOLORINFO_
+#ifndef VLC__SKIP_TRUECOLORINFO
+#define VLC__SKIP_TRUECOLORINFO
+#  ifdef _TRUECOLORINFO_
+#    warning "_TRUECOLORINFO_ is deprecated, use VLC__SKIP_TRUECOLORINFO"
+#  else
+#    define _TRUECOLORINFO_
 typedef struct
 ATTR_PACKED
 {
     uint32_t dwBitMasks[3];
     RGBQUAD1 bmiColors[256];
 } TRUECOLORINFO;
+#  endif
 #endif
 
-#ifndef _VIDEOINFO_
-#define _VIDEOINFO_
+#ifndef VLC__SKIP_VIDEOINFO
+#define VLC__SKIP_VIDEOINFO
+#  ifdef _VIDEOINFO_
+#    warning "_VIDEOINFO_ is deprecated, use VLC__SKIP_VIDEOINFO"
+#  else
+#    define _VIDEOINFO_
 typedef struct
 ATTR_PACKED
 {
@@ -208,6 +271,7 @@ ATTR_PACKED
     };
 
 } VIDEOINFO;
+#  endif
 #endif
 
 #if defined(__SUNPRO_C) || defined(_MSC_VER)
@@ -503,4 +567,4 @@ static inline void sf_tag_to_fourcc( const GUID *guid_tag,
     }
 }
 
-#endif /* "codecs.h" */
+#endif /* include-guard */
-- 
2.7.1



More information about the vlc-devel mailing list