Skip to content

Reuse paired pragma headers for full numeric range checks - #3653

Open
user01010111 wants to merge 1 commit into
networkupstools:masterfrom
user01010111:refactor/range-check-pragmas
Open

user01010111 wants to merge 1 commit into
networkupstools:masterfrom
user01010111:refactor/range-check-pragmas

Conversation

@user01010111

Copy link
Copy Markdown
Contributor

This moves eight matching numeric-range diagnostic blocks in the client and
HID communication code into a private, repeat-includable header pair, following
the covered-switch pattern from #3599 and the remaining work in #3595.

The five GCC warning guards, push/pop condition, Clang branch and diagnostic
order are preserved. The enclosed checks, casts and control flow are unchanged.
The headers are distributed as private build inputs, and the developer guide
describes where this pair applies. Variants with different warnings remain
local.

Validation on Linux:

  • GCC 16 hard and Clang 22 medium warning builds with -Werror, compiling
    libupsclient, usbhid-ups with both libusb APIs, and mge-shut.
  • Exact source reconstruction for all eight pairs, all 64 capability states
    in GCC/Clang C/C++, and repeated-inclusion and diagnostic-restoration probes.
  • Existing tests: 14/14 suite entries and 35/35 CppUnit cases in each of the
    four compiler/USB configurations.
  • Developer-guide rendering, strict spelling of the changed document, ASCII
    and whitespace checks.
  • make distcheck-light, extracted-archive replay, and confirmation that the
    new headers are distributed but not installed as public headers.

The default spelling check still reports the unchanged possessives kernel's
and firmware's in NEWS.adoc and docs/man/apcmicrolink.txt, also reproduced
at the exact base revision. The test and distribution continuation used
SPELLCHECK_ERROR_FATAL=no; the changed developer document passes the strict
check. Hardware and other operating systems were not tested.

AI assistance: OpenAI Codex with gpt-6-astra at xhigh reasoning.
The human contributor remains responsible for reviewing and validating this change.

Refs: #3595

Move eight matching diagnostic blocks into repeat-includable private
headers. Preserve the GCC capability guards, Clang branch, pragma order
and all enclosed code. Register both headers for distribution and
describe this warning family in the developer guide.

Refs: networkupstools#3595

Prepared with OpenAI Codex using gpt-6-astra at xhigh reasoning.

Signed-off-by: user01010111 <lapses.50.booster@icloud.com>
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit a141958 is temporarily available: NUT-tarballs-PR-3653.zip.

@jimklimov jimklimov added refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings portability We want NUT to build and run everywhere possible AI For good or bad, machine tools are upon us. Humans are still the responsible ones. labels Sep 15, 2026
@jimklimov jimklimov added this to the 2.8.6 milestone Sep 15, 2026
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5326-master completed (commit 49a9106e31 by @)

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

Labels

AI For good or bad, machine tools are upon us. Humans are still the responsible ones. portability We want NUT to build and run everywhere possible refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants