Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-11-30
13:15 • Closed ticket [2991415fff]: tclport.h #include'd before limits.h plus 6 ... artifact: ce1dba2341 user: nijtmans
2011-11-29
21:25 • Ticket [2991415fff]: 4 changes artifact: 38d80273c1 user: nijtmans
20:16 • Open ticket [2991415fff]. artifact: 75f97bbc09 user: dkf
20:16 • Ticket [2991415fff]: 4 changes artifact: eca642f964 user: dkf
2010-05-25
17:38 • Ticket [2991415fff]: 4 changes artifact: f457124975 user: nijtmans
2010-04-29
14:37 • Closed ticket [2991415fff]. artifact: ed875f5954 user: nijtmans
2010-04-28
22:27 • Open ticket [2991415fff]. artifact: 526b20d5be user: lvirden
22:18 • Pending ticket [2991415fff]. artifact: 28211f0297 user: nijtmans
2010-04-27
21:06 • Ticket [2991415fff]: 1 change artifact: e5a477fd68 user: nijtmans
21:05 • Ticket [2991415fff]: 4 changes artifact: f3aeb7f53c user: nijtmans
19:29 • Ticket [2991415fff]: 4 changes artifact: a79d7b4aee user: nijtmans
19:15 • Ticket [2991415fff]: 4 changes artifact: 3f194dfaeb user: nijtmans
19:01 • Ticket [2991415fff]: 4 changes artifact: d2170d76c3 user: nijtmans
18:56 • Ticket [2991415fff]: 4 changes artifact: adb6d23c6f user: nijtmans
2010-04-23
22:46 • Ticket [2991415fff]: 4 changes artifact: 9bd2f77c63 user: nijtmans
22:45 • Ticket [2991415fff]: 4 changes artifact: 0ce908443d user: nijtmans
22:06 • Ticket [2991415fff]: 5 changes artifact: c3edf598b3 user: nijtmans
21:53 • Ticket [2991415fff]: 4 changes artifact: 168f72ead2 user: lvirden
14:52 • New ticket [2991415fff]. artifact: c86f4e9887 user: lvirden

tclport.h #include'd before limits.h

Closed / Fixed2991415fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 15 years ago
Descriptionplain2010-04-23 14:52:04
SunOS 8, Sun C compiler, Tcl 8.6 cvs head

The tclport.h header appears set up to define a variety of macros if not already defined in the compile environment.

In theory, then, it should be included after any general or os specific headers, such as limits.h, giving the OS the opportunity to define the values appropriately for the specific platform.

with the current CVS head, I see the following warnings:

cc .*     /vol/tclsrcsol/tcl86/tcl/generic/regcomp.c
"/usr/include/limits.h", line 236: warning: macro redefined: LLONG_MIN
"/usr/include/limits.h", line 237: warning: macro redefined: LLONG_MAX
:
as well as most, if not all, of the rest of the tcl core c modules have the same warning being produced.

There are a number of other warnings output during compilation of the tcl source - but none so consistent as these. The libtommath pkg modules don't generate the warning and some of the itcl pkg modules do not...
lvirdenplain2010-04-23 21:53:59
Okay, so the warning is telling me that the OS value for the define is being used. That's the good news.

It would be nice if this particular pair of warnings were not being issued, IMO.
nijtmansplain2010-04-23 22:06:22
Having a look
nijtmansplain2010-04-23 22:45:43
I see what is going on.

In tclInt.h:
#ifdef NO_LIMITS_H
#   include "../compat/limits.h"
#else
#   include <limits.h>
#endif

But files which only include tclPort.h and
not tclInt.h will mis this. Those lines
should be moved to tclPort.h.
nijtmansplain2010-04-23 22:46:57
Added the include in "tclUnixPort.h". Should be fixed now.
nijtmansplain2010-04-27 18:56:12
I'm still not sure that this bug is really
fixed when NO_LIMITS_H is set.
Observation: tclUnixPort.h:
#ifdef NO_LIMITS_H
#   include "../compat/limits.h"
#else
#   include <limits.h>
#endif
But in a lot of places of the core, e.g.
"regguts.h", <limits.h> is included regardless
of the NO_LIMITS_H setting. Let's evaluate
the use of some standard C header files
(separate issues in separate comments)
nijtmansplain2010-04-27 19:01:03
"regguts.h" includes "regcustom.h", which includes
"tclInt.h", which includes <stdio.h>, <stdlib.h>,
<ctype.h>, <limits.h> and <string.h>. This means
that inclusion of those header files in "regguts.h"
serves no purpose.
nijtmansplain2010-04-27 19:15:29
All C files which include "tommath.h", always include "tclInt.h"
first. So, it does not do any harm to include "tclInt.h" in
tclTomMath.h as well. This allows us to remove the <stdio.h>,
<string.h>, <stdlib.h>, <ctype.h> and <limits.h> includes there.
nijtmansplain2010-04-27 19:29:27
In tclBasic.c, tclExecute.c, tclObj.c, tclStrToD.c,
tclTomMathInterface.c, tclUtil.c, compat/strtod.c
and compat/strtol.c, "tclInt.h" is included already,
so various system includes become unnessesary.
nijtmansplain2010-04-27 21:05:57
Checked in in HEAD. Tested OK on Linux, MSVC 6.0, Mingw32 and CYGWIN
nijtmans Ticket [2991415fff]: 1 change [History diff]2010-04-27 21:06:12
nijtmansplain2010-04-28 22:18:03
Larry, please confirm that everything is OK now in HEAD.
lvirdenplain2010-04-28 22:27:13
Okay, I downloaded the tar file from activestate's cvs ftp site. I configured and built it. The warnings that I see in the tcl core are "statement not reached" and "end-of-loop code not reached". No other warnings in the tcl core. 

There are warnings in the packaged itcl - but I've reported them on that site and the developer is working on them.
nijtmansplain2010-04-29 14:37:32
allow_comments - 1

Thanks, Closing.
nijtmansplain2010-05-25 17:38:14
Backported to 8.5 branch.
dkfplain2011-11-29 20:16:37
The patch associated with this bug (https://core.tcl.tk/tcl/info/b7c55dd4bf) has the down side of making a publicly-installed header (tclTomMath.h) depend on a non-public header (tclInt.h). That Cannot Be Right.
dkfplain2011-11-29 20:16:38
allow_comments - 0
nijtmansplain2011-11-29 21:25:19
Right. Proposed solution:
Move the
   #include "tclInt.h"
from tclTomMath.h to tommath.h

(didn't test that yet, but will do that)


Besides, under Windows, the header files
tommath_class.h and tommath_superclass.h
are installed, but on UNIX they don't.


Good catch!
nijtmansplain2011-11-30 13:15:59
allow_comments - 1

Moved it to tclTomMathInt.h, which is even more logical
Log in (anonymous is fine) to add a comment.