On 25/09/2019 17:16, Stephan Bergmann wrote:
~ gcc $(pkg-config -cflags glib-2.0) -c test.c
test.c:2:13: warning: const
    2 | G_CONST_RETURN char * f();
      |             ^~~~~~~

emits a cryptic warning (and gets the positioning of the squiggly underline wrong).

On both F30 and F31, /usr/include/glib-2.0/glib/gmacros.h contains

/* Deprecated -- do not use. */
#ifndef G_DISABLE_DEPRECATED
#ifdef G_DISABLE_CONST_RETURNS
#define G_CONST_RETURN
#else
#define G_CONST_RETURN const
#endif
#endif

so I'm not sure what causes the warning to be emitted on F31 but not on F30.

So Clang gives it away:

test.c:2:1: warning: const [-W#pragma-messages]
G_CONST_RETURN char * f();
^
/usr/include/glib-2.0/glib/gmacros.h:913:30: note: expanded from macro 
'G_CONST_RETURN'
#define G_CONST_RETURN const GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const)
                             ^
/usr/include/glib-2.0/glib/gversionmacros.h:387:49: note: expanded from macro 
'GLIB_DEPRECATED_MACRO_IN_2_30_FOR'
# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f)   GLIB_DEPRECATED_MACRO_FOR(f)
                                                ^
/usr/include/glib-2.0/glib/gmacros.h:990:38: note: expanded from macro 
'GLIB_DEPRECATED_MACRO_FOR'
#define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning #f)
                                     ^
/usr/include/glib-2.0/glib/gmacros.h:988:33: note: expanded from macro 
'_GLIB_GNUC_DO_PRAGMA'
#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
                                ^
<scratch space>:110:6: note: expanded from here
 GCC warning "const"
     ^
1 warning generated.

(At least partly; /usr/include/glib-2.0/glib/gmacros.h has only 540 lines, there's no line 913; so whatever #line tricks get played there...)
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to