Discussion:
[cairo] Troublesome C99 ?
John Emmas
2017-12-05 10:51:50 UTC
Permalink
Hi there,

This morning I noticed this change in git master (which produces a
syntax error now when compiling with MSVC):-

// In 'scr/cairo-svg.h' :-
typedef enum _cairo_svg_unit {
CAIRO_SVG_UNIT_USER = 0,
CAIRO_SVG_UNIT_EM,
CAIRO_SVG_UNIT_EX,
CAIRO_SVG_UNIT_PX,
CAIRO_SVG_UNIT_IN,
CAIRO_SVG_UNIT_CM,
CAIRO_SVG_UNIT_MM,
CAIRO_SVG_UNIT_PT,
CAIRO_SVG_UNIT_PC,
CAIRO_SVG_UNIT_PERCENT
} cairo_svg_unit_t;


// In 'src/cairo-svg-surface.c' :-
static const char * _cairo_svg_unit_strings[] =
{
[CAIRO_SVG_UNIT_USER] = "", // <--- error occurs here !!
[CAIRO_SVG_UNIT_EM] = "em",
[CAIRO_SVG_UNIT_EX] = "ex",
[CAIRO_SVG_UNIT_PX] = "px",
[CAIRO_SVG_UNIT_IN] = "in",
[CAIRO_SVG_UNIT_CM] = "cm",
[CAIRO_SVG_UNIT_MM] = "mm",
[CAIRO_SVG_UNIT_PT] = "pt",
[CAIRO_SVG_UNIT_PC] = "pc",
[CAIRO_SVG_UNIT_PERCENT] = "%"
}

I think it's ( possibly? ) C99, which MSVC never fully supported :-(

John
--
cairo mailing list
***@cairographics.org
https:/
John Emmas
2017-12-08 06:52:29 UTC
Permalink
Hi guys,

Just bumping this in case anyone's got any ideas (or do I need to post
it somewhere else?)  Thanks,

John
Post by John Emmas
Hi there,
This morning I noticed this change in git master (which produces a
syntax error now when compiling with MSVC):-
// In 'scr/cairo-svg.h' :-
    typedef enum _cairo_svg_unit {
        CAIRO_SVG_UNIT_USER = 0,
        CAIRO_SVG_UNIT_EM,
        CAIRO_SVG_UNIT_EX,
        CAIRO_SVG_UNIT_PX,
        CAIRO_SVG_UNIT_IN,
        CAIRO_SVG_UNIT_CM,
        CAIRO_SVG_UNIT_MM,
        CAIRO_SVG_UNIT_PT,
        CAIRO_SVG_UNIT_PC,
        CAIRO_SVG_UNIT_PERCENT
    } cairo_svg_unit_t;
// In 'src/cairo-svg-surface.c' :-
    static const char * _cairo_svg_unit_strings[] =
    {
        [CAIRO_SVG_UNIT_USER] = "",  // <--- error occurs here !!
        [CAIRO_SVG_UNIT_EM] = "em",
        [CAIRO_SVG_UNIT_EX] = "ex",
        [CAIRO_SVG_UNIT_PX] = "px",
        [CAIRO_SVG_UNIT_IN] = "in",
        [CAIRO_SVG_UNIT_CM] = "cm",
        [CAIRO_SVG_UNIT_MM] = "mm",
        [CAIRO_SVG_UNIT_PT] = "pt",
        [CAIRO_SVG_UNIT_PC] = "pc",
        [CAIRO_SVG_UNIT_PERCENT] = "%"
    }
I think it's ( possibly? ) C99, which MSVC never fully supported :-(
John
--
cairo mailing list
***@cairographics.org
https://lists.cairographics.org/mailman/listin
Antonio Ospite
2017-12-08 09:02:57 UTC
Permalink
On Tue, 05 Dec 2017 10:51:50 +0000
Post by John Emmas
Hi there,
This morning I noticed this change in git master (which produces a
syntax error now when compiling with MSVC):-
[...]
Post by John Emmas
// In 'src/cairo-svg-surface.c' :-
static const char * _cairo_svg_unit_strings[] =
{
[CAIRO_SVG_UNIT_USER] = "", // <--- error occurs here !!
[...]
Post by John Emmas
I think it's ( possibly? ) C99, which MSVC never fully supported :-(
This was me, I assumed using C99 initializers was OK.
If it's not then the attached patch fixes this.

Should I send it over to bugzilla?

BTW when compilation fails it is generally a good idea to report the
exact message from the compiler.

Ciao,
Antonio
--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
John Emmas
2017-12-08 09:28:47 UTC
Permalink
Post by Antonio Ospite
This was me, I assumed using C99 initializers was OK.
If it's not then the attached patch fixes this.
Should I send it over to bugzilla?
BTW when compilation fails it is generally a good idea to report the
exact message from the compiler.
Hi Antonio. I normally do report the errors but in this case it was
simply:- "error C2059: syntax error : '[' ".

Your patch works fine BTW. Many thanks,

John
--
cairo mailing list
***@cairographics.org
ht
Bryce Harrington
2017-12-11 04:22:58 UTC
Permalink
Post by John Emmas
Post by Antonio Ospite
This was me, I assumed using C99 initializers was OK.
If it's not then the attached patch fixes this.
Should I send it over to bugzilla?
BTW when compilation fails it is generally a good idea to report the
exact message from the compiler.
Hi Antonio. I normally do report the errors but in this case it was
simply:- "error C2059: syntax error : '[' ".
Your patch works fine BTW. Many thanks,
Thanks, pushed:

To ssh://git.freedesktop.org/git/cairo
f9cf6f9..19ee921 master -> master



commit 19ee9211879ad8c90ee7d467d8d9495dc9a0fa88
Author: Antonio Ospite <***@ao2.it>
AuthorDate: Fri Dec 8 09:44:27 2017 +0100
Commit: Bryce Harrington <***@osg.samsung.com>
CommitDate: Sun Dec 10 20:13:19 2017 -0800

svg: fix compilation with MSVC which doesn't support C99
initializers

Reviewed-by: Bryce Harrington <***@osg.samsung.com>
Tested-by: John Emmas <***@creativepost.co.uk>
--
cairo mailing list
***@cairographics.org
https://lists.cairographics.org/mailm
Loading...