Skip to content

lib: use (u)int64_t instead of long long#20233

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/uint64
Closed

lib: use (u)int64_t instead of long long#20233
bagder wants to merge 1 commit into
masterfrom
bagder/uint64

Conversation

@bagder

@bagder bagder commented Jan 9, 2026

Copy link
Copy Markdown
Member

Remove config-plan9.h because it does not support 64 bit, meaning it has not been working for years.

@bagder
bagder marked this pull request as ready for review January 9, 2026 17:20
@bagder

bagder commented Jan 9, 2026

Copy link
Copy Markdown
Member Author

augment review

@augmentcode

augmentcode Bot commented Jan 9, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR modernizes curl’s internal 64-bit handling by removing legacy long long feature-detection and using fixed-width (u)int64_t instead.

Changes:

  • Drops the autotools HAVE_LONGLONG configure check and removes related config-header defines.
  • Removes the Plan 9 libcurl config header (lib/config-plan9.h) since it cannot meet the 64-bit curl_off_t requirement.
  • Updates platform config headers (mac/OS400/RISC OS/Win32) to stop defining HAVE_LONGLONG/SIZEOF_LONG_LONG.
  • Updates the CMake-generated config template to no longer emit HAVE_LONGLONG and SIZEOF_LONG_LONG.
  • Refactors lib/mprintf.c to store numeric varargs as int64_t/uint64_t rather than a conditional “max int” type.
  • Simplifies lib/sha256.c by using uint64_t for 64-bit length tracking and big-endian writes.

Technical Notes: Assumes a 64-bit curl_off_t is mandatory and removes conditional code paths that attempted to support smaller/legacy integer models.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread lib/mprintf.c
Comment thread configure.ac
Comment thread lib/curl_config-cmake.h.in
@github-actions github-actions Bot added tests CI Continuous Integration labels Jan 9, 2026
@bagder
bagder requested a review from Copilot January 9, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modernizes curl's codebase by replacing compiler-specific long long / unsigned long long types with standard C99 int64_t / uint64_t types. The PR removes support for platforms without 64-bit type support, including Plan 9.

Key changes:

  • Replaced long long and unsigned long long with int64_t and uint64_t throughout the codebase
  • Removed config-plan9.h configuration file for Plan 9 platform (which lacked working 64-bit support)
  • Removed HAVE_LONGLONG and SIZEOF_LONG_LONG configuration checks from build systems (autoconf, CMake, VMS)
  • Simplified type handling in lib/mprintf.c, lib/sha256.c, and test utilities

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/sha256.c Replace unsigned long long / unsigned __int64 with uint64_t in WPA_PUT_BE64 macro and sha256_state struct
lib/mprintf.c Replace mp_intmax_t/mp_uintmax_t typedefs with direct int64_t/uint64_t usage
tests/libtest/testutil.c Simplify rlim_t formatting logic (contains bug - see comments)
lib/config-plan9.h Delete entire Plan 9 configuration file
lib/config-mac.h Remove TYPE_LONGLONG conditional and unconditionally set SIZEOF_CURL_OFF_T to 8
lib/config-os400.h Remove HAVE_LONGLONG and SIZEOF_LONG_LONG definitions
lib/config-riscos.h Remove SIZEOF_LONG_LONG definition
lib/config-win32.h Remove HAVE_LONGLONG definition
lib/curl_config-cmake.h.in Remove HAVE_LONGLONG and SIZEOF_LONG_LONG cmake defines
lib/Makefile.am Remove config-plan9.h from EXTRA_DIST
configure.ac Remove AC_CHECK_TYPE check for long long
CMakeLists.txt Remove SIZEOF_LONG_LONG size check and HAVE_LONGLONG set logic
CMake/unix-cache.cmake Remove HAVE_LONGLONG cache setting
packages/vms/config_h.com Remove LONGLONG and SIZEOF_LONG_LONG code generation
m4/curl-wolfssl.m4 Remove SIZEOF_LONG and SIZEOF_LONG_LONG undef workarounds and CURL_SIZEOF(long long) call
.github/scripts/cmp-config.pl Remove SIZEOF_LONG_LONG from ignored differences

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/libtest/testutil.c Outdated
Comment thread lib/config-mac.h
Remove config-plan9.h because it does not support 64 bit, meaning it has
not been working for years.
@bagder bagder closed this in 0159100 Jan 10, 2026
@bagder
bagder deleted the bagder/uint64 branch January 10, 2026 11:41
vszakats added a commit to vszakats/curl that referenced this pull request Jan 10, 2026
@vszakats

vszakats commented Jan 10, 2026

Copy link
Copy Markdown
Member

Is there an upside keeping the plan9 build subdir?

It seemed to have relied on config-plan9.h, or, it would need the 64-bit support anyway.

@bagder

bagder commented Jan 10, 2026

Copy link
Copy Markdown
Member Author

Nah, we should remove it

vszakats added a commit to vszakats/curl that referenced this pull request Jan 10, 2026
vszakats added a commit that referenced this pull request Jan 10, 2026
It's no longer used in curl.

Follow-up to 0159100 #20233

Closes #20241
vszakats added a commit that referenced this pull request Jan 10, 2026
Would need 64-bit support.

Ref: #20233 (comment)
Follow-up to 0159100 #20233

Closes #20243
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration tests

Development

Successfully merging this pull request may close these issues.

3 participants