[PATCH 00/37] Warning fixes (post 1.15 proposed changes)

Jasper St. Pierre jstpierre at mecheye.net
Mon Nov 18 07:55:43 PST 2013


The warnings are trying to prevent you from freeing a string constant and
having corrupt memory or double frees or worse. Casts are a *very* bad way
to work around the issue, and I'd highly recommend that if you want to
potentially free something, you use `char *`, not `const char *`.


On Mon, Nov 18, 2013 at 10:42 AM, Keith Packard <keithp at keithp.com> wrote:

> Thierry Reding <thierry.reding at gmail.com> writes:
>
> > Of course to make proper use of that, quite a bit of code will need to
> > be changed first.
>
> Having miles of compiler warning spam is not helpful though, so we need
> to tailor the warning set to those which are actually useful for a
> particular project. In this case, X uses the same data structures to
> hold both string constants and allocated memory. I can think of lots of
> fixes for this, but simply sticking a cast in the free parameter seems
> the least invasive to me, while preserving most of the checks. Having to
> hack around the -Wcast-qual check with an intermediate cast to
> (uintptr_t) seems silly.
>
> --
> keith.packard at intel.com
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131118/534433bf/attachment.html>


More information about the xorg-devel mailing list