Skip to content
  • Thomas Haller's avatar
    giscanner: undef "GLIB_VERSION_{MAX_ALLOWED,MIN_REQUIRED}" macros in generated C file · cde5de91
    Thomas Haller authored and Emmanuele Bassi's avatar Emmanuele Bassi committed
    When g-ir-scanner is used by another project, than that project might
    have the GLIB_VERSION_* macros defined. This is useful to ensure that
    only intended glib API is used.
    
    The project might then also pass the CFLAGS to g-ir-scanner, without
    filtering those defines out. This can lead to compiler warnings.
    
    For example, NetworkManager sets the version macros to GLIB_VERSION_2_40
    and thus gets these warnings
    
      /NetworkManager/tmp-introspect66917zc4/NM-1.0.c: In function ‘dump_object_type’:
      /NetworkManager/tmp-introspect66917zc4/NM-1.0.c:252:13: warning: Not available before 2.70
        252 |   if (G_TYPE_IS_FINAL (type))
            |             ^~~~~~~~~~~~~~~~~
      /NetworkManager/tmp-introspect66917zc4/NM-1.0.c: In function ‘dump_fundamental_type’:
      /NetworkManager/tmp-introspect66917zc4/NM-1.0.c:370:13: warning: Not available before 2.70
        370 |   if (G_TYPE_IS_FINAL (type))
            |             ^~~~~~~~~~~~~~~~...
    cde5de91