Ticket #665 (closed patch: fixed)

Opened 5 years ago

Last modified 5 years ago

Pmc2c gets confused when name in "pmclass" line mismatches the filename

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

Description

From darbelo++'s report:

pmc2c gnerates .h files named after the input file, but includes files based on the PMC name. This was a factor on yesterday's 'sploding.
It's easy to work around: Name your files the same as your PMC (or the other way around), but it feels like a bug to me.

/--
$ cat foo.pmc                                                                                        
pmclass bar {

}
# pmc2c --dump, pmc2c --c, etc.
$ ls *h
pmc_foo.h

$ grep include foo.c                                                                                 
#include "parrot/parrot.h"
#include "parrot/extend.h"
#include "parrot/dynext.h"
#include "pmc_bar.h"
#include "pmc_default.h"
#include "bar.str"
#include "pmc_continuation.h"
#include "pmc_default.h"

<darbelo> I have a PMC named bar in a file name foo.pmc.
<darbelo> pmc2c generates pmc_foo.h

So pmc2c has inconsistent header file handling when the pmclass name doesn't match the filename (other than the pmclass name being capitalized).

I'm not sure whether we want to support different names. If so, pmc2c needs to be fixed up. If not, it might help if pmc2c emits a big nasty error message about it... apparently this was the cause of much head-scratching.

Here's a patch to emit a big nasty error message. I'm not sure whether it needs a deprecation cycle or not; it's conceiveable that some HLL out there relies on this (rather insane) behavior.

Attachments

big_nasty_error_message.patch Download (0.9 KB) - added by Infinoid 5 years ago.
Emit a big nasty error message when the names don't match.

Change History

Changed 5 years ago by Infinoid

Emit a big nasty error message when the names don't match.

Changed 5 years ago by Infinoid

  • owner set to Infinoid
  • milestone set to 1.5

A warn() version of the patch was applied as part of r38932. I've added it to DEPRECATED.pod, and the warn() can be upgraded to a die() after the 1.4 release.

Changed 5 years ago by Infinoid

  • patch changed from new to applied

Changed 5 years ago by allison

The tests in t/tools/pmc2c.t need to be changed so they don't dump warning messages out during 'make test'.

Changed 5 years ago by whiteknight

  • milestone 1.5 deleted

Changed 5 years ago by darbelo

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

After the release of Parrot 1.6 I've updated the warn() to a die(). The test failures have been skipped after this change. But I'm not sure they're useful at this point. I'll close this ticket, and open a new one to address this point.

Note: See TracTickets for help on using tickets.