Ticket #573 (closed patch: fixed)

Opened 5 years ago

Last modified 5 years ago

Netbsd can't compile parrot on alpha platform, due to va_list type confusion

Reported by: Infinoid Owned by:
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords: alpha va_list netbsd
Cc: Language:
Patch status: applied Platform: netbsd

Description

C89 does not guarantee va_list being a pointer type. Apparently on netbsd-alpha, it's actually a struct.

There's at least one place where we try to pass NULL in place of a va_list argument. On netbsd-alpha, this fails to compile.

Attachments

netbsd-alpha-valist.patch Download (1.3 KB) - added by Infinoid 5 years ago.
New patch implementing allison++'s suggestion. Needs testing, should hopefully get it building a little farther.

Change History

Changed 5 years ago by Infinoid

The attached patch has a big problem, in that it will require a deprecation cycle to change this API. Fortunately, allison++ has a better idea. Here's the full conversation:

he> ./src/pmc/class.pmc:338: error: incompatible type for argument 4 of 'Parrot_pcc_build_sig_object_from_varargs'
he> "va_list isn't by necessity compatible with a pointer"
Infinoid> no, but &va_list should be, perhaps we should convert that interface
Infinoid> (if we want to pass NULL like that caller is doing)
he> Yep.
Infinoid> Hmm, changing the Parrot_pcc_build_sig_object_from_varargs interface would require a deprecation cycle, we probably couldn't change that interface until a few months from now
Infinoid> allison, do you have any better suggestions?
allison> we have to be able to pass pointers to varargs some distance, but it doesn't have to be far
allison> (no more than 1 function call in the new model)
Infinoid> is there something we can call that will get the same result as calling Parrot_pcc_build_sig_object_from_varargs with a NULL va_list?
Infinoid> (since we're not actually passing any varargs, I have to wonder if there's a better function.)
allison> well, if it's a null varags list, then we don't need to call it at all
Infinoid> moritz: me too, thanks for mentioning it
Infinoid> in that case, ./src/pmc/class.pmc:338 should hopefully be easy to fix
allison> Infinoid: We'll likely want a singleton (PMCNULL_SIGNATURE) for subs that pass no arguments and return no values
allison> Infinoid: PMCNULL would do for now, but it'd be nice to know it was intentional

I'm not sure how much of that is already implemented, but I believe that's the direction this patch should go in.

If we need to be able to pass a pointer to the varargs, as allison said at the beginning of this conversation, and just passing the struct directly won't do, then we need to sweat out the deprecation period and change the API. But in the meantime, just eliminating the NULL will allow netbsd-alpha to build properly.

Changed 5 years ago by Infinoid

Oops. I forgot to mention, this bug report and attached patch are both courtesy of he++. Thanks!

Changed 5 years ago by Infinoid

New patch implementing allison++'s suggestion. Needs testing, should hopefully get it building a little farther.

Changed 5 years ago by Infinoid

  • status changed from new to closed
  • resolution set to fixed
  • patch changed from new to applied

he++ verified on IRC that the patch works.

Checked in as r38276.

Changed 5 years ago by Infinoid

Followup: there was one remaining diff lurking in the pkgsrc patches directory for this, for the last month. That issue was also reported as #647 (HPUX platform). I've checked that in as r38900, and we should build cleanly on both platforms now.

Note: See TracTickets for help on using tickets.