codegen: Fix floating reference regression with Variants
[vala-gnome.git] / ccode / valaccodeggnucsection.vala
blobf4a28e384000b359ef34e2f25535a07ca68cf8c3
1 /* valaccodeggnucsection.vala
3 * Copyright (C) 2016 Rico Tzschichholz
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Rico Tzschichholz <ricotz@ubuntu.com>
23 using GLib;
25 /**
26 * Represents a section that should be processed on condition.
28 public class Vala.CCodeGGnucSection : CCodeFragment {
29 /**
30 * The expression
32 public GGnucSectionType section_type { get; set; }
34 public CCodeGGnucSection (GGnucSectionType t) {
35 section_type = t;
38 public override void write (CCodeWriter writer) {
39 writer.write_string ("G_GNUC_BEGIN_");
40 writer.write_string (section_type.to_string ());
41 writer.write_newline ();
42 foreach (CCodeNode node in get_children ()) {
43 node.write_combined (writer);
45 writer.write_string ("G_GNUC_END_");
46 writer.write_string (section_type.to_string ());
47 writer.write_newline ();
50 public override void write_declaration (CCodeWriter writer) {
54 public enum Vala.GGnucSectionType {
55 IGNORE_DEPRECATIONS;
57 public unowned string to_string () {
58 switch (this) {
59 case IGNORE_DEPRECATIONS:
60 return "IGNORE_DEPRECATIONS";
61 default:
62 assert_not_reached ();