Skip to content

compiler: drop CONFIG_HAVE_LONG_LONG and require long long support#18841

Closed
xiaoxiang781216 wants to merge 1 commit into
apache:masterfrom
xiaoxiang781216:compiler/remove-have-long-long
Closed

compiler: drop CONFIG_HAVE_LONG_LONG and require long long support#18841
xiaoxiang781216 wants to merge 1 commit into
apache:masterfrom
xiaoxiang781216:compiler/remove-have-long-long

Conversation

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

Summary

CONFIG_HAVE_LONG_LONG is set to 1 for every modern toolchain that NuttX
supports, so the indirection is no longer useful. Drop the config knob and
the surrounding #ifdef/#ifndef CONFIG_HAVE_LONG_LONG ladders, and treat
long long as unconditionally available across the OS.

Impact

  • include/nuttx/compiler.h: remove all #define/#undef of the macro and
    the dead #ifndef CONFIG_HAVE_LONG_LONG block at the end of the file.
  • Headers and sources under include/, drivers/, fs/, libs/, sched/:
    unwrap #ifdef CONFIG_HAVE_LONG_LONG (keep then-branch, drop else-branch),
    drop #ifndef CONFIG_HAVE_LONG_LONG blocks (always dead).
  • libs/libc/libc.csv: drop unconditional/now-dead rows referencing the
    macro and clear the column where the condition was always true.
  • libs/libc/fixedmath/lib_fixedmath.c: removed (entire file body was the
    dead #ifndef branch).
  • Documentation/applications/netutils/ntpclient/index.rst: drop the bullet.

Testing

  • tools/checkpatch.sh -f is clean on all changed files (only pre-existing
    long-line / case-on-new-line errors remain in untouched code).

Companion PR

apache/nuttx-apps companion PR is required for the apps/-side preprocessor
clean-up.

All compilers supported by NuttX provide "long long" types, so the
CONFIG_HAVE_LONG_LONG indirection is no longer useful.  Remove the
configuration knob and the conditional code paths that were guarded
by it; treat "long long" as unconditionally available across the OS.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Copilot AI review requested due to automatic review settings May 3, 2026 08:25
@github-actions github-actions Bot added Area: Drivers Drivers issues Size: M The size of the change in this PR is medium Area: Audio labels May 3, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the CONFIG_HAVE_LONG_LONG configuration knob and treats long long (and related 64-bit integer types) as unconditionally available across NuttX, simplifying headers/sources that previously had alternate code paths.

Changes:

  • Remove CONFIG_HAVE_LONG_LONG definitions/undefs and unwrap dependent preprocessor conditionals across the tree.
  • Make long long-based APIs and implementations (printf/scanf, crc64, fixedmath helpers, etc.) unconditional.
  • Clean up ancillary build metadata/docs impacted by the removal (e.g., fixedmath build files, ntpclient docs, libc API CSV).

Reviewed changes

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

Show a summary per file
File Description
sched/irq/irq_procfs.c Removes CONFIG_HAVE_LONG_LONG gating and updates procfs IRQ output note.
sched/clock/clock.h Drops dead CONFIG_SYSTEM_TIME64 undef tied to CONFIG_HAVE_LONG_LONG.
libs/libm/libm/lib_llroundl.c Makes llroundl availability depend only on long double support.
libs/libm/libm/lib_llroundf.c Makes llroundf unconditional.
libs/libm/libm/lib_llround.c Makes llround depend only on double support.
libs/libc/string/lib_vikmemcpy.c Removes long-long-based config undef guard for 64-bit memcpy option.
libs/libc/string/lib_memset.c Removes long-long-based config undef guard for 64-bit memset option.
libs/libc/string/lib_flsll.c Makes flsll implementation unconditional.
libs/libc/string/lib_ffsll.c Makes ffsll implementation unconditional.
libs/libc/stream/lib_ultoa_invert.h Removes long-long availability gating for CONFIG_LIBC_LONG_LONG validity comment/undef.
libs/libc/stream/lib_libvsprintf.c Unwraps long long handling paths in printf implementation.
libs/libc/stream/lib_libvscanf.c Unwraps long long handling paths in scanf implementation.
libs/libc/stream/lib_libbsprintf.c Unwraps long long handling in binary sprintf helper.
libs/libc/stdlib/lib_strtoull.c Makes strtoull implementation unconditional.
libs/libc/stdlib/lib_strtoll.c Makes strtoll implementation unconditional.
libs/libc/stdlib/lib_strtold.c Removes non-long-long fallback typedef/macro path.
libs/libc/stdlib/lib_rand48.c Unwraps rand48 family implementation using 64-bit math.
libs/libc/stdlib/lib_lldiv.c Makes lldiv unconditional.
libs/libc/stdlib/lib_llabs.c Makes llabs unconditional.
libs/libc/stdlib/lib_atoll.c Makes atoll unconditional.
libs/libc/misc/lib_crc64emac.c Makes CRC64-EMAC implementation unconditional.
libs/libc/misc/lib_crc64.c Makes CRC64 implementation unconditional.
libs/libc/lzf/lzf_c.c Removes non-uint64_t fallback type for compression offset variable.
libs/libc/libc.csv Removes/updates CONFIG_HAVE_LONG_LONG conditions in exported libc symbol list.
libs/libc/inttypes/lib_strtoimax.c Makes strtoimax implementation unconditional.
libs/libc/fixedmath/lib_ubsqrt.c Makes ub32sqrtub16 implementation unconditional.
libs/libc/fixedmath/lib_fixedmath.c Removes dead fixedmath fallback file body (entire file removed).
libs/libc/fixedmath/Make.defs Drops removed fixedmath source from build list.
libs/libc/fixedmath/CMakeLists.txt Drops removed fixedmath source from build list.
include/sys/epoll.h Makes epoll_data_t include u64 member unconditionally.
include/sys/endian.h Makes 64-bit endian swap helpers/macros unconditional.
include/strings.h Makes ffsll/flsll declarations unconditional (and related builtin macros).
include/stdlib.h Makes long-long-related stdlib prototypes unconditional.
include/stddef.h Makes max_align_t include a long long member unconditionally.
include/nuttx/lib/stdbit.h Removes CONFIG_HAVE_LONG_LONG from builtin requirement checks (now unconditional 64-bit builtin requirement).
include/nuttx/lib/math32.h Removes long-long gating around 64-bit helper macros/implementations.
include/nuttx/lib/math.h Makes llround*/llrint* declarations unconditional.
include/nuttx/crc64.h Makes crc64 API definitions/prototypes unconditional.
include/nuttx/compiler.h Removes all CONFIG_HAVE_LONG_LONG define/undef logic and dependent dead guards.
include/nuttx/clock.h Drops dead CONFIG_SYSTEM_TIME64 undef tied to CONFIG_HAVE_LONG_LONG.
include/nuttx/audio/audio.h Makes 64-bit capability control member unconditional.
include/fixedmath.h Removes long-long gating and non-long-long fallback declarations/macros.
include/cxx/cstdlib Makes C++ std:: imports for long-long stdlib APIs unconditional.
fs/spiffs/src/spiffs.h Removes off_t fallback and makes media_size always off64_t.
drivers/note/note_driver.c Unwraps long long handling in note printf capture logic.
Documentation/applications/netutils/ntpclient/index.rst Removes documentation requirement for CONFIG_HAVE_LONG_LONG.

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

Comment thread fs/spiffs/src/spiffs.h
FAR uint8_t *mtd_work; /* MTD I/O buffer for read-modify-write */
FAR void *cache; /* Cache memory */
#ifdef CONFIG_HAVE_LONG_LONG
off64_t media_size; /* Physical size of the SPI flash */
Comment thread libs/libc/libc.csv
"strtoul","stdlib.h","","unsigned long","FAR const char *","FAR char **","int"
"strtoull","stdlib.h","","unsigned long long int","FAR const char *","FAR char **","int"
"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","FAR const char *","FAR char **","int"
"strtoull","stdlib.h","","unsigned long long","FAR const char *","FAR char **","int"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Audio Area: Drivers Drivers issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants