compiler: drop CONFIG_HAVE_LONG_LONG and require long long support#18841
Closed
xiaoxiang781216 wants to merge 1 commit into
Closed
compiler: drop CONFIG_HAVE_LONG_LONG and require long long support#18841xiaoxiang781216 wants to merge 1 commit into
xiaoxiang781216 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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_LONGdefinitions/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.
| 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 */ |
| "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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CONFIG_HAVE_LONG_LONGis set to1for every modern toolchain that NuttXsupports, so the indirection is no longer useful. Drop the config knob and
the surrounding
#ifdef/#ifndef CONFIG_HAVE_LONG_LONGladders, and treatlong longas unconditionally available across the OS.Impact
include/nuttx/compiler.h: remove all#define/#undefof the macro andthe dead
#ifndef CONFIG_HAVE_LONG_LONGblock at the end of the file.include/,drivers/,fs/,libs/,sched/:unwrap
#ifdef CONFIG_HAVE_LONG_LONG(keep then-branch, drop else-branch),drop
#ifndef CONFIG_HAVE_LONG_LONGblocks (always dead).libs/libc/libc.csv: drop unconditional/now-dead rows referencing themacro and clear the column where the condition was always true.
libs/libc/fixedmath/lib_fixedmath.c: removed (entire file body was thedead
#ifndefbranch).Documentation/applications/netutils/ntpclient/index.rst: drop the bullet.Testing
tools/checkpatch.sh -fis clean on all changed files (only pre-existinglong-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.