[vlc-devel] [PATCH] configure: add macro definitions for stdint.h on C++

KO Myung-Hun komh78 at gmail.com
Wed May 20 02:38:44 CEST 2015


Some macros such as INT64_C() are not declared on C++ without
__STDC_FORMAT_MACROS, __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS
even if stdint.h is included.
---
 configure.ac                                             | 2 ++
 modules/access/dcp/dcp.cpp                               | 1 -
 modules/access/decklink.cpp                              | 2 --
 modules/access/dshow/dshow.cpp                           | 2 --
 modules/access/live555.cpp                               | 6 ------
 modules/demux/adaptative/PlaylistManager.cpp             | 6 ------
 modules/demux/adaptative/Streams.cpp                     | 1 -
 modules/demux/adaptative/playlist/Segment.cpp            | 2 --
 modules/demux/adaptative/playlist/SegmentInformation.hpp | 4 ----
 modules/demux/adaptative/playlist/SegmentTimeline.cpp    | 2 --
 modules/demux/dash/DASHManager.cpp                       | 6 ------
 modules/demux/dash/dash.cpp                              | 2 --
 modules/demux/dash/mpd/DASHSegment.cpp                   | 2 --
 modules/demux/mkv/mkv.hpp                                | 6 ------
 modules/demux/sid.cpp                                    | 5 -----
 modules/gui/qt4/components/extended_panels.cpp           | 2 --
 modules/gui/qt4/components/info_panels.cpp               | 3 ---
 modules/gui/qt4/input_manager.cpp                        | 3 ---
 modules/gui/qt4/menus.cpp                                | 3 ---
 modules/services_discovery/upnp.cpp                      | 2 --
 modules/stream_out/chromecast/cast.cpp                   | 4 ----
 modules/video_filter/atmo/AtmoLiveView.cpp               | 2 --
 modules/video_filter/atmo/atmo.cpp                       | 1 -
 modules/video_output/decklink.cpp                        | 3 ---
 modules/visualization/projectm.cpp                       | 3 ---
 modules/visualization/vsxu.cpp                           | 3 ---
 26 files changed, 2 insertions(+), 76 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d5d0e2..1400fc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,8 @@ case "${host}" in
         ;;
 esac
 
+# stdint.h requires these macros on C++
+CXXFLAGS="${CXXFLAGS} -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS"
 
 case "${host_os}" in
   "")
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index e53b1f8..691b1d7 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -40,7 +40,6 @@
 # include "config.h"
 #endif
 
-#define __STDC_CONSTANT_MACROS 1
 #define KDM_HELP_TEXT          "KDM file"
 #define KDM_HELP_LONG_TEXT     "Path to Key Delivery Message XML file"
 
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index d1b9c33..55c48b8 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -22,8 +22,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#define __STDC_CONSTANT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index eb181c7..0d5ce04 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -30,8 +30,6 @@
 # include "config.h"
 #endif
 
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_FORMAT_MACROS 1
 #define CFG_PREFIX "dshow-"
 #include <inttypes.h>
 #include <list>
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index a3faa77..4b84e8e 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -28,12 +28,6 @@
  * Preamble
  *****************************************************************************/
 
-/* For inttypes.h
- * Note: config.h may include inttypes.h, so make sure we define this option
- * early enough. */
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
index 5811259..4ba53f2 100644
--- a/modules/demux/adaptative/PlaylistManager.cpp
+++ b/modules/demux/adaptative/PlaylistManager.cpp
@@ -19,12 +19,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-/* config.h may include inttypes.h, so make sure we define that option
- * early enough. */
-#define __STDC_FORMAT_MACROS
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index 633cc3b..93c4aa5 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -17,7 +17,6 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#define __STDC_CONSTANT_MACROS
 #include "Streams.hpp"
 #include "StreamsType.hpp"
 #include "http/HTTPConnection.hpp"
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index 4dcb1c5..7e2c5ee 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -21,8 +21,6 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#define __STDC_CONSTANT_MACROS
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.hpp b/modules/demux/adaptative/playlist/SegmentInformation.hpp
index ed51743..840d2ac 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.hpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.hpp
@@ -20,10 +20,6 @@
 #ifndef SEGMENTINFORMATION_HPP
 #define SEGMENTINFORMATION_HPP
 
-#ifndef __STDC_CONSTANT_MACROS
-  #define __STDC_CONSTANT_MACROS
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.cpp b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
index 9101a62..54f5d78 100644
--- a/modules/demux/adaptative/playlist/SegmentTimeline.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
@@ -20,8 +20,6 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#define __STDC_CONSTANT_MACROS
-
 #include "SegmentTimeline.h"
 
 #include <algorithm>
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index 9006594..30dcfc0 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -22,12 +22,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-/* config.h may include inttypes.h, so make sure we define that option
- * early enough. */
-#define __STDC_FORMAT_MACROS 1
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/dash/dash.cpp b/modules/demux/dash/dash.cpp
index 7421594..169f01e 100644
--- a/modules/demux/dash/dash.cpp
+++ b/modules/demux/dash/dash.cpp
@@ -25,8 +25,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#define __STDC_CONSTANT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/dash/mpd/DASHSegment.cpp b/modules/demux/dash/mpd/DASHSegment.cpp
index 6422fb4..6d80ebc 100644
--- a/modules/demux/dash/mpd/DASHSegment.cpp
+++ b/modules/demux/dash/mpd/DASHSegment.cpp
@@ -21,8 +21,6 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#define __STDC_CONSTANT_MACROS
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 7157bda..aae48de 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -30,12 +30,6 @@
  *****************************************************************************/
 
 
-/* config.h may include inttypes.h, so make sure we define that option
- * early enough. */
-#define __STDC_FORMAT_MACROS 1
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
index c31a659..d2a71a3 100644
--- a/modules/demux/sid.cpp
+++ b/modules/demux/sid.cpp
@@ -33,11 +33,6 @@
 # include <config.h>
 #endif
 
-/* INT64_C and UINT64_C are only exposed to c++ if this is defined */
-#ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS
-#endif
-
 #include <vlc_common.h>
 #include <vlc_input.h>
 #include <vlc_demux.h>
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index 7059a29..5b318ad 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -23,8 +23,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#define __STDC_FORMAT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
index a2d8db1..3ebff49 100644
--- a/modules/gui/qt4/components/info_panels.cpp
+++ b/modules/gui/qt4/components/info_panels.cpp
@@ -23,9 +23,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#define __STDC_FORMAT_MACROS 1
-#define __STDC_CONSTANT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index eb68848..2010c40 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -23,9 +23,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#define __STDC_FORMAT_MACROS 1
-#define __STDC_CONSTANT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 6e51d15..d1c48f5 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -27,9 +27,6 @@
  * - Remove static currentGroup
  */
 
-#define __STDC_FORMAT_MACROS 1
-#define __STDC_CONSTANT_MACROS 1
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 097a92b..1f345cf 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -26,8 +26,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#define __STDC_CONSTANT_MACROS 1
-
 #include "upnp.hpp"
 
 #include <vlc_access.h>
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index f568150..d609e49 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -33,10 +33,6 @@
 # include <poll.h>
 #endif
 
-#ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS
-#endif
-
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
diff --git a/modules/video_filter/atmo/AtmoLiveView.cpp b/modules/video_filter/atmo/AtmoLiveView.cpp
index 8cef916..fb03c14 100644
--- a/modules/video_filter/atmo/AtmoLiveView.cpp
+++ b/modules/video_filter/atmo/AtmoLiveView.cpp
@@ -12,8 +12,6 @@
 # include "config.h"
 #endif
 
-#define __STDC_FORMAT_MACROS 1
-
 #include "AtmoDefs.h"
 #include "AtmoLiveView.h"
 #include "AtmoOutputFilter.h"
diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
index 5de3e6b..4b1f1c8 100644
--- a/modules/video_filter/atmo/atmo.cpp
+++ b/modules/video_filter/atmo/atmo.cpp
@@ -28,7 +28,6 @@
 /*****************************************************************************
 * Preamble
 *****************************************************************************/
-#define __STDC_FORMAT_MACROS 1
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 #include <math.h>                                            /* sin(), cos() */
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index c0b2d1e..62087d3 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -26,9 +26,6 @@
  * TODO: test non stereo audio
  */
 
-#define __STDC_FORMAT_MACROS
-#define __STDC_CONSTANT_MACROS
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
index 9d2cf53..2fe007d 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -25,9 +25,6 @@
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
-#ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS
-#endif
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
diff --git a/modules/visualization/vsxu.cpp b/modules/visualization/vsxu.cpp
index d71bbf1..a58e162 100644
--- a/modules/visualization/vsxu.cpp
+++ b/modules/visualization/vsxu.cpp
@@ -28,9 +28,6 @@
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
-#ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS
-#endif
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-- 
1.8.5.2




More information about the vlc-devel mailing list