Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
vala
vala
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 701
    • Issues 701
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 39
    • Merge Requests 39
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GNOME
  • valavala
  • Issues
  • #72

Closed
Open
Opened Feb 16, 2010 by bugzilla-migration@bugzilla-migrationReporter

SimpleType code generation broken

Submitted by Sebastian Dröge @sdroege

Link to original bug (#610083)

Description

Hi, the code generation for SimpleTypes is broken. Take as example the following:

[SimpleType]
[Immutable]
[CCode (copy_function = "fraction_copy")]
struct Fraction {
  public int num;
  public int den;

  public Fraction copy () {
    return Fraction (num, den);
  }

  public Fraction (int num, int den) {
    this.num = num;
    this.den = den;
  }

  public Fraction mult (Fraction other) {
    return Fraction (num * other.num, den * other.den);
  }
}

Some errors in the generated code are:

void fraction_init (Fraction self, gint num, gint den): This initializes self, but as self is passed by value this has absolutely no effect. It should either be passed by reference for that function or should be returned. Code that uses fraction_init() expect that it returns the initialized instance and that it only takes the num/den parameters and not the self parameter. In fraction_init(), self is simply passed to memset while the address of it should be passed.

I'll try to create a patch for this to work later.

Edited Dec 08, 2018 by Rico Tzschichholz
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
1.0
Milestone
1.0
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/vala#72