Opened 8 years ago

Closed 8 years ago

#7669 closed defect (fixed)

SIZEOF_INTPTR_T not defined in msvc builds

Reported by: ultramage Owned by:
Priority: Medium Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: msvc tor-client
Cc: Actual Points:
Parent ID: #7754 Points:
Reviewer: Sponsor:


Change 1bfda600 added a block of helper code to src/common/compat.h that assumes SIZEOF_INTPTR_T is defined. While this is the case for configure-driven builds (defines available since 2004), for the prepared win32 config the define is nowhere to be found. This causes a compilation error.

I looked and saw that torint.h introduces type intptr_t when HAVE_INTPTR_T is not present. Also, it does #if (SIZEOF_INTPTR_T != 0) #define HAVE_INTPTR_T, so just defining it in orconfig.h would actually break this code. My first guess is that torint.h should define the sizeof at the moment it adds the intptr_t typedef. There might be better solutions.

PS: uintptr_t should be dealt with as well.

Child Tickets

Change History (7)

comment:1 Changed 8 years ago by ultramage

Actually, win32/orconfig.h #undefs all SIZEOF_*_T values (since by default the int*_t types are not available), and torint.h neglects to define the SIZEOF in all places where it introduces the _t types. So the scope of the issue is somewhat larger.

comment:2 Changed 8 years ago by nickm

Keywords: tor-client added
Milestone: Tor: 0.2.4.x-final

If I do a patch for this, can I ask you to review and test it? Right now,

comment:3 Changed 8 years ago by nickm

whoops. Didn't finish my thought.

If I do a patch for this, can I ask you to review and test it? Right now it's pretty inconvenient for me to test MSVC builds.

Adding a SIZEOF_* define in torint.h for stuff we define seems like an okay approach to me.

Probably the best solution here would be to bring win32/orconfig.h into sync with all of the stuff that should be getting defined there.

comment:4 Changed 8 years ago by ultramage

As a quick workaround in my checkout I did this right above the offending code:

#if !defined(SIZEOF_INTPTR_T) && defined(_MSC_VER)

I tried adding stuff to torint.h, but got confused by the overlapping #if checks. It should be possible to do, if done carefully.

comment:5 Changed 8 years ago by nickm

Parent ID: #7754

comment:6 Changed 8 years ago by nickm

Status: newneeds_review

This is in the 024_msvc branch.

comment:7 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged a fix for this into master as of b998431a33db2b.

Note: See TracTickets for help on using tickets.