scanner: Correctly handle large 64 bit integer constants
authorColin Walters <walters@verbum.org>
Fri, 26 Oct 2012 20:46:05 +0000 (16:46 -0400)
committerColin Walters <walters@verbum.org>
Tue, 30 Oct 2012 12:20:36 +0000 (08:20 -0400)
commit383b0bdcc8e295d06035768062389797d3ba9262
treee024519716913823e22abcd46294a3dc48bd9acd
parentce4a25dc640bdb02ff30fc233abb1c468721cbbd
scanner: Correctly handle large 64 bit integer constants

In C, positive integer constants are by default unsigned.  This means
an expression like 0x8000000000000000 will be "unsigned long long".

In the actual scanner code, we were parsing them as "gint64", and
storing them as gint64.  This was incorrect; we need to parse them
as guint64, and store the bits we get from that.  This gives us
an equivalent result to what the C compiler does.

However, when we actually return the value as a Python "long"
(arbitrary length integer), we need to treat the value as unsigned if
the result indicated it was.

https://bugzilla.gnome.org/show_bug.cgi?id=685022
giscanner/giscannermodule.c
giscanner/scannerparser.y
giscanner/sourcescanner.h
tests/scanner/Regress-1.0-expected.gir
tests/scanner/regress.h