View Ticket
Not logged in
2016-06-14
09:12
(cherry-pick): Fix [e14c77b845]: Compilation error over typedef. check-in: eb44f9209e user: jan.nijtmans tags: core-8-5-branch
2016-06-09
13:37 Ticket [e14c77b845] Compilation error over typedef status still Closed with 6 other changes artifact: eb22216e40 user: oehhar
11:43 Ticket [e14c77b845]: 5 changes artifact: 40e0ee8bdd user: jan.nijtmans
11:41
Fix [e14c77b845] for MSVC6: Compilation error over typedef check-in: c7cea9d704 user: jan.nijtmans tags: trunk
11:38
Fix [e14c77b845] for MSVC6: Compilation error over typedef check-in: 66a48888ae user: jan.nijtmans tags: core-8-6-branch
07:18 Ticket [e14c77b845] Compilation error over typedef status still Closed with 6 other changes artifact: b9b9dd1f33 user: oehhar
2016-06-08
12:54 Ticket [e14c77b845]: 5 changes artifact: 29f61a912f user: jan.nijtmans
2016-06-07
15:04 Ticket [e14c77b845]: 5 changes artifact: 27f586acb5 user: dgp
2016-06-02
14:58 Closed ticket [e14c77b845]. artifact: 891fe8ca88 user: jan.nijtmans
14:56
Fix [e14c77b845]: Compilation error over typedef. check-in: 942948a1ea user: jan.nijtmans tags: trunk
14:54
Fix [e14c77b845]: Compilation error over typedef. check-in: 65c8108ed2 user: jan.nijtmans tags: core-8-6-branch
2016-04-12
13:56 Ticket [e14c77b845] Compilation error over typedef status still Open with 3 other changes artifact: 9835da8033 user: griffin
12:25 Ticket [e14c77b845]: 3 changes artifact: 34327b3909 user: dgp
2016-04-08
17:03 Ticket [e14c77b845]: 3 changes artifact: 6590d3ca00 user: griffin
15:42 New ticket [e14c77b845]. artifact: 55f0a6344a user: griffin

Ticket UUID: e14c77b845ee4f52954de716a8b885f7fa9c9980
Title: Compilation error over typedef
Type: Bug Version: 8.6.5
Submitter: griffin Created on: 2016-04-08 15:42:15
Subsystem: 69. Other Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2016-06-09 13:37:33
Resolution: Fixed Closed By: oehhar
    Closed on: 2016-06-09 13:37:33
Description:
I got a compilation error on Windows using Visual Studio 2013 (a.k.a. cl version 12.0), 64-bit, when building itk3.4.2.  The error was a redefined typedef:    typedef int ptrdiff_t;
I was able to work around the problem with this change:

$ diff -c ../devm3/prod/src/tcltk/8.6.x/tcl8.6.5/generic/tclInt.h prod/src/tcltk/8.6.x/tcl8.6.5/generic/tclInt.hprod/src/tcltk/8.6.x/tcl8.6.5/generic/tclInt.h          <
*** ../devm3/prod/src/tcltk/8.6.x/tcl8.6.5/generic/tclInt.h     2016-01-19 04:57:54.000000000 -0800
--- prod/src/tcltk/8.6.x/tcl8.6.5/generic/tclInt.h      2016-04-07 09:27:40.000000000 -0700
***************
*** 51,58 ****
--- 51,60 ----
  #ifdef STDC_HEADERS
  #include <stddef.h>
  #else
+ #ifndef _PTRDIFF_T_DEFINED
  typedef int ptrdiff_t;
  #endif
+ #endif


Really, "int" for a pointer diff type for a 64-bit build is the wrong size in general.
User Comments: oehhar added on 2016-06-09 13:37:33:

For me it compiles and runs well. Test caused ticket [db0a5f6417] ;-)

Thanks, Harald


jan.nijtmans added on 2016-06-09 11:43:00:
Thanks, Harald!  Should really be fixed now in all branches.

oehhar added on 2016-06-09 07:18:50:

> In which header file is ptrdiff_t typedef'd on MSVC6?

I made a grep-style search for "ptrdiff_t" on the MS-VC6 include folder

C:\Program Files (x86)\Microsoft Visual Studio\VC98\Include

There is one match: "STDDEF.H"

The snipped defining "ptrdiff_t" is as follows (line 84):

/* define the implementation dependent size types */

#ifndef _PTRDIFF_T_DEFINED
typedef int ptrdiff_t;
#define _PTRDIFF_T_DEFINED
#endif

Hope this helps, Harald


jan.nijtmans added on 2016-06-08 12:54:43:
In which header file is ptrdiff_t typedef'd on MSVC6?

dgp added on 2016-06-07 15:04:05:
patthoyts	Hello. The commit recently for http://core.tcl.tk/tcl/info/e14c77b845 had introduced a problem when building with msvc6 on windows as crtdef.h doesn't exist.
patthoyts	If someone would like to poke the appropriate bug lists or whatever to get some fallthrough as suggested in the original bug submission it would be useful.
patthoyts	Of course, maybe you no longer support such ancient compilers.

patthoyts	For reference of build failure: https://jenkins.patthoyts.tk/job/TclKit/617/console
patthoyts	cheers all.

jan.nijtmans added on 2016-06-02 14:58:26:
According to microsoft documentation, ptrdiff_t is supposed to be defined by crtdefs.h. Fixed in core-8-6-branch and trunk.

griffin added on 2016-04-12 13:56:51:
There exists a stddef.h file, but STDC_HEADERS is not defined.  Nor is __STDC__.  I speculate that since this is 64-bit Windows, the data/pointer model may not match standard C.

I changed the code to this and it seems to work:

#if defined(STDC_HEADERS) || defined(_WIN64)
#include <stddef.h>
#else
typedef int ptrdiff_t;
#endif

dgp added on 2016-04-12 12:25:54:
What do we know about the STDC_HEADERS value?  Is it
not getting set properly?

Is there really no <stddef.h> file at compile time?

griffin added on 2016-04-08 17:03:32:
Sorry, itcl, not itk:

        cl -nologo -c -W3 -YX -Fp.\Release_AMD64_VC12\itcl_Dynamic\ -Zi -Od -RTC1  -MD -I..\win -I..\generic -DBUILD_itcl -DTCL_THRE
ADS=1 -I"C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include" -DTCL_CFGVAL_ENCODING=\"cp1252\" -DTCL_CFG_OPTIMIZE
D -DUSE_TCL_STUBS -Fo.\Release_AMD64_VC12\itcl_Dynamic\ @C:\tmp\nm7FA1.tmp
cl : Command line warning D9002 : ignoring unknown option '-YX'
itcl_bicmds.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_class.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_cmds.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_ensemble.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_linkage.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_migrate.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_methods.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_objects.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_parse.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itcl_util.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
itclStubInit.c
C:\home\bgriffin\devmainwin\build\win64\tclcore86\opt\usr\include\tclInt.h(55) : error C2371: 'ptrdiff_t' : redefinition; diffe
rent basic types
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(528) : see declaration of 'ptrdiff_t'
Generating Code...
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~3.0\VC\BIN\amd64\cl.EXE' : return code '0x2'
Stop.
make: *** [INCRTCL] Error 2