Bug#604738: libglib2.0-dev: defined function throw away constness, causing warnings from compiler

Petter Reinholdtsen pere at hungry.com
Tue Nov 23 22:32:43 UTC 2010


Package: libglib2.0-dev 
Version: 2.24.2-1
Severity: important

When building gnash, some compiler warning like this show up when
building in Squeeze:

  gst/VideoInputGst.cpp:492: warning: cast from type 'const GValue*'
    to type 'GValue*' casts away constness

A complete list of warnings can be seen in <URL: http://gnashdev.org:8010/builders/squeeze-linux-x86/builds/15/steps/compile/logs/warnings%20(332) >.

To reproduce this, compile this source with lots of warning enabled:

  % cat x.c
  #include <gst/gst.h>
  int main(int argc, char *argv[]) {
  {
    const GValue *framerates;
    if (GST_VALUE_HOLDS_FRACTION(framerates))
        return 1;
    return 0;
  }
  % gcc -W -Wall -Wcast-align -Wcast-qual -Wpointer-arith \
    -Wreturn-type -Wmissing-declarations -Wmissing-prototypes \
    -Wstrict-prototypes $(pkg-config --cflags --libs gstreamer-0.10) \
    -c x.c

The cause is this code in /usr/include/glib-2.0/gobject/gtype.h:

  #define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((GValue*) vl, gt))

It is throwing away the constness of the vl argument.  Given that it
only read the value content, it would be better if it cast to (const
GValue *) instead.

Setting severity to important, as this problem make it hard to find
the warnings in the gnash code.

Happy hacking,
--
Petter Reinholdtsen






More information about the pkg-gnome-maintainers mailing list