diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-24 13:43:21 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-24 19:40:31 +0100 |
commit | 3d926c1288b3ec4fd692dd1de6b91fb6c2090183 (patch) | |
tree | 6df8522bd7a61e5161b3998eff0d227724cb6462 /compiler | |
parent | 32ffc862417be39d42a1b8eeb3d0748b3e138aff (diff) | |
download | vala-3d926c1288b3ec4fd692dd1de6b91fb6c2090183.tar.gz |
vala: Move setting of default defines for VALA_0_XX and GLIB_2_XX to Context
This avoids duplicated code and reduces the setup burden for library users.
Also start to warn about redefinitions, especially for our default defines.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/valacompiler.vala | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index 405a4965e..e0b02060e 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -300,30 +300,14 @@ class Vala.Compiler { } } - for (int i = 2; i <= 44; i += 2) { - context.add_define ("VALA_0_%d".printf (i)); - } - if (context.profile == Profile.POSIX) { if (!nostdpkg) { /* default package */ context.add_external_package ("posix"); } } else if (context.profile == Profile.GOBJECT) { - int glib_major = 2; - int glib_minor = 40; - if (target_glib != null && target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) { - Report.error (null, "Invalid format for --target-glib"); - } - - context.target_glib_major = glib_major; - context.target_glib_minor = glib_minor; - if (context.target_glib_major != 2) { - Report.error (null, "This version of valac only supports GLib 2"); - } - - for (int i = 16; i <= glib_minor; i += 2) { - context.add_define ("GLIB_2_%d".printf (i)); + if (target_glib != null) { + context.set_target_glib_version (target_glib); } if (!nostdpkg) { |