After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758541 - gstinfo: Fix ISO non-standard predefined identifier warning for __FUNCTION__ when compiled with gcc 5 -Wpedantic
gstinfo: Fix ISO non-standard predefined identifier warning for __FUNCTION__ ...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.x
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-23 14:07 UTC by Lukasz Forynski
Modified: 2015-11-24 13:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to address the issue. (1.24 KB, patch)
2015-11-23 14:07 UTC, Lukasz Forynski
none Details | Review
Updated patch to address the issue (1.56 KB, patch)
2015-11-24 09:09 UTC, Lukasz Forynski
committed Details | Review

Description Lukasz Forynski 2015-11-23 14:07:52 UTC
Created attachment 316094 [details] [review]
Patch to address the issue.

gstreamer 1.6.1, when compiled with gcc 5, produces  a warning about non-standard identifier __FUNCTION__ use when used with -Wpedantic (which might turn into an error if compiled also with -Werror). C99 support is fully enabled
with gcc 5 (without -std=c99 switch), therefore attached patch implements the
first suggested solution as proposed in [1].
Comment 1 Lukasz Forynski 2015-11-23 14:09:12 UTC
[1]: https://gcc.gnu.org/gcc-5/porting_to.html
Comment 2 Tim-Philipp Müller 2015-11-23 14:20:45 UTC
Comment on attachment 316094 [details] [review]
Patch to address the issue.

> #ifndef GST_FUNCTION
> #if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
>-#  define GST_FUNCTION     ((const char*) (__FUNCTION__))
>+#  if __GNUC__ < 5
>+#    define GST_FUNCTION     ((const char*) (__FUNCTION__))
>+#  else
>+#    define GST_FUNCTION     ((const char*) (__func__))
>+#  endif
> #elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
> #  define GST_FUNCTION     ((const char*) (__func__))
> #else

I wonder if moving up the 

 #elif defined (__STDC__) && defined (__STDC_VERSION__) && 

would also fix this issue?
Comment 3 Lukasz Forynski 2015-11-23 14:38:21 UTC
Possibly. Intention was to keep the change 'minimal', i.e. it introduces a change only for gcc 5 builds - indeed moving _STDC_ up would work - and might be more appropriate.
Comment 4 Tim-Philipp Müller 2015-11-23 16:53:57 UTC
Could you try please? :)
Comment 5 Lukasz Forynski 2015-11-23 18:01:44 UTC
Sure, I am going to - just need a couple of hours more to get home to be able to do that - I was going to post the result once finished.
Comment 6 Lukasz Forynski 2015-11-24 09:09:10 UTC
Created attachment 316146 [details] [review]
Updated patch to address the issue
Comment 7 Tim-Philipp Müller 2015-11-24 09:40:06 UTC
Thanks for the patch, pushed (reworded the commit message a little to point out the -Wpedantic aspect of it):

commit 7e2aae7942f4232ee7a9e84c52d265b722890da3
Author: Lukasz Forynski <lukasz.forynski@youview.com>
Date:   Mon Nov 23 21:40:34 2015 +0000

    info: fix compiler warning with -Wpedantic and gcc 5
    
    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
Comment 8 Lukasz Forynski 2015-11-24 13:37:06 UTC
Thanks Tim-Philipp