Closed Bug 432769 Opened 16 years ago Closed 16 years ago

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

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: vladimir.sukhoy, Unassigned)

References

Details

Attachments

(1 file)

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.
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.
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.
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.
Attached patch fixSplinter Review
Attachment #320075 - Flags: review?
Attachment #320075 - Flags: review? → review?(dmandelin)
Comment on attachment 320075 [details] [diff] [review]
fix

Perfect.
Attachment #320075 - Flags: review?(dmandelin) → review+
Pushed.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: