info: fix compiler warning with -Wpedantic and gcc 5
authorLukasz Forynski <lukasz.forynski@youview.com>
Mon, 23 Nov 2015 21:40:34 +0000 (21:40 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 24 Nov 2015 09:34:59 +0000 (09:34 +0000)
Gstreamer compiled with gcc 5.2 and -Wpedantic produces the
following warning:

'ISO C does not support '__FUNCTION__' predefined identifier [-Wpedantic]
  const char *s = __FUNCTION__;'

Since gcc 5 enables C99 by default, use __func__ if it's available
instead of the non-standard __FUNCTION__ (as suggested in [2]).

[1]: https://gcc.gnu.org/gcc-5/changes.html
[2]: https://gcc.gnu.org/gcc-5/porting_to.html

https://bugzilla.gnome.org/show_bug.cgi?id=758541

gst/gstinfo.h

index d4678ac..bc7580d 100644 (file)
@@ -250,10 +250,10 @@ struct _GstDebugCategory {
  * function signature in C++ code.
  */
 #ifndef GST_FUNCTION
-#if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
-#  define GST_FUNCTION     ((const char*) (__FUNCTION__))
-#elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #  define GST_FUNCTION     ((const char*) (__func__))
+#elif defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
+#  define GST_FUNCTION     ((const char*) (__FUNCTION__))
 #else
 #  define GST_FUNCTION     ((const char*) ("???"))
 #endif