Dehydra/Treehydra: should not cast location_t to int on a mac

RESOLVED FIXED

Status

Firefox Build System
Source Code Analysis
RESOLVED FIXED
10 years ago
5 months ago

People

(Reporter: Vlad Sukhoy, Unassigned)

Tracking

Trunk
x86
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
In dehydra.c:

dehydra_defineProperty (this, obj, "_source_location", INT_TO_JSVAL(loc));

breaks mac because loc is larger than int there. Can't we just store bytes of it in a JS string or something?
Summary: should not cast location_t to int on a mac → Dehydra/Treehydra: should not cast location_t to int on a mac
What exactly is the failure mode? If the values actually fit in ints, then it could be made to work by adding another cast or something.
(Reporter)

Comment 2

10 years ago
it doesn't fit in an int. because it is as follows:

struct  GTY(()) location_s
{
  /* The name of the source file involved.  */
  const char *file;

  /* The line-location in the source file.  */
  int line;
};

typedef struct location_s expanded_location;
typedef struct location_s location_t;
typedef location_t *source_locus;

so it's an int and a pointer.
OK, given this I think you can just leave off _source_location on the Mac, and then just modify Diagnostic() to set up a new location_s structure if needed for %H.

Comment 4

10 years ago
Is this specific to mac or to gcc 4.2? Probably ought to file these bugs as "shouldn't do X on GCC 4.2" if that's actually the difference.
(Reporter)

Comment 5

10 years ago
Not sure how gcc 4.2 is configured on linux by default. This is actually specific to apple's gcc42 config not using  USE_MAPPED_LOCATION define during gcc build which turns on mapped locations (and columns in them). I am not sure why apple does it this way with their gcc.
(Reporter)

Comment 6

10 years ago
Created attachment 320075 [details] [diff] [review]
fix
Attachment #320075 - Flags: review?
(Reporter)

Updated

10 years ago
Attachment #320075 - Flags: review? → review?(dmandelin)
Comment on attachment 320075 [details] [diff] [review]
fix

Perfect.
Attachment #320075 - Flags: review?(dmandelin) → review+
(Reporter)

Comment 8

10 years ago
Pushed.
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED

Updated

5 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.