Tk Source Code

View Ticket
Login
Ticket UUID: 48079fad7225468ee19dd762a1ce5afd8dd8c3f1
Title: revised_text still uses compat/stdint.h
Type: Patch Version: revised_text
Submitter: chrstphrchvz Created on: 2023-07-15 07:11:40
Subsystem: 81. Portability Assigned To: fvogel
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2023-07-18 18:53:04
Resolution: Fixed Closed By: fvogel
    Closed on: 2023-07-18 18:53:04
Description:

This code in tkInt.h on branch revised_text should be removed, since as of [ef0cb66f3ad1] compat/stdint.h was removed and tkInt.h already includes stdint.h.

/*
 * Standard integer support (C99).
 */

#ifdef HAVE_STDINT_H # include <stdint.h> #else /* work around for the support of ancient compilers */ # include "../compat/stdint.h" #endif

User Comments: fvogel added on 2023-07-18 18:53:04:

For the records: done in [1702718c].


fvogel added on 2023-07-17 18:43:50:

Are the two comments here still valid?


jan.nijtmans added on 2023-07-17 06:59:52:

> Can we get rid of those as well?

Unfortunately, not! The one in "configure" is generated by autoconf, the one in tkConfig.h.in is generated by autoheader, and "rules.vc" is shared with Tk 8.6. So, I think, we cannot do more than that now.


fvogel added on 2023-07-17 06:24:20:

Even after your commit [4021f2cd] we still have a few occurrences in revised_text and trunk, in configure and makefiles. Can we get rid of those as well?


jan.nijtmans added on 2023-07-17 06:12:05:

Best is not to use HAVE_STDINT_H anywhere any more. Since 8.7, we only support C99 as a minimum, so just assuming HAVE_STDINT_H is set is OK.


fvogel added on 2023-07-15 18:41:40:
Merged in revised_text branch.

fvogel added on 2023-07-15 08:42:15:

Correct, thanks! I have removed the block calling compat/stdint.h in [d1fcd4487c].

Regarding usage of HAVE_STDINT_H for 32/64 bit detection:

  • HAVE_STDINT_H is defined for Windows as long as MSVC version is > 1600 i.e. starting at Visual Studio 2012 (if I got this right). For older Windows compiler versions there is a fallback based on _WIN64 or _WIN32 being defined.
  • For Linux, HAVE_STDINT_H is defined (or not) at configure time.
  • For macOS aqua I didn't check.

It's true that in case HAVE_STDINT_H is not defined on Linux or mac, then the build in tkInt.h will fail with "cannot detect architecture" error. Is this a prroblem? At first sight I think this #ifdef HAVE_STDINT_H block could be kept as is. What changes did you have in mind?


chrstphrchvz added on 2023-07-15 07:25:47:

Note that immediately after this code is usage of HAVE_STDINT_H (32/64 bit detection). Maybe it should also be revised.