Skip to content

20261109-macro-number-parens - #12072

Open
douzzer wants to merge 1 commit into
wolfSSL:masterfrom
douzzer:20261109-macro-number-parens
Open

douzzer wants to merge 1 commit into
wolfSSL:masterfrom
douzzer:20261109-macro-number-parens

Conversation

@douzzer

@douzzer douzzer commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

src/, test/, wolfcrypt/src/, wolfssl/: Remove frivolous parentheses around positive integers in macros (fixes false positives from clang -Wunreachable-code-return with -Wunreachable-code-aggressive).

discovered with and tested by

wolfssl-multi-test.sh ...
benchmark-wolfcrypt-intelasm-sp-asm-all-clang

changes were purely mechanical:

sed -i -E 's/(# *define +[^ ]+(\([^)]*\))? +)\(([0-9]+|0[xX][0-9a-fA-F]+)([uU]?[lL]?[lL]?)\)/\1\3\4/' $(git grep -l -E '# *define +[^ ]+(\([^)]*\))? +\(([0-9]+|0[xX][0-9a-fA-F]+)[uU]?[lL]?[lL]?\)' wolfssl wolfcrypt/src/ wolfcrypt/test/ tests/ src/ | egrep -v '/port/|wolfcrypt/src/sp_')

…round positive integers in macros (fixes false positives from clang -Wunreachable-code-return with -Wunreachable-code-aggressive).
Copilot AI balanced review requested due to automatic review settings November 10, 2026 00:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the macro cleanup intended to reduce Clang unreachable-code false positives.

No open issues 🎉

What changed in this PR

Removes redundant parentheses around integer-literal macros across wolfSSL, wolfCrypt, and tests to address false positives from Clang’s aggressive unreachable-code warnings, without changing numeric values.

Changes:

  • Simplifies integer constants and constant-returning function-like macros.
  • Preserves parentheses around compound expressions.
  • Normalizes RNG limit suffixes from lowercase l to uppercase L.
File Description
wolfssl/​wolfcrypt/​wolfentropy.h Simplifies entropy scaling constants.
wolfssl/​wolfcrypt/​wc_xmss.h Simplifies XMSS length constants.
wolfssl/​wolfcrypt/​wc_port.h Simplifies constant time macros.
wolfssl/​wolfcrypt/​types.h Simplifies the compiler-version fallback macro.
wolfssl/​wolfcrypt/​sp_int.h Simplifies the constant sign-check macro.
wolfssl/​wolfcrypt/​settings.h Simplifies platform and key-size constants.
wolfssl/​wolfcrypt/​random.h Simplifies RNG constants and normalizes long suffixes.
wolfssl/​wolfcrypt/​async.h Simplifies the default thread priority.
wolfssl/​wolfcrypt/​aes.h Simplifies the key-check fallback macro.
wolfssl/​quic.h Simplifies the record-capacity constant.
wolfssl/​openssl/​x509.h Simplifies the compatibility flag constant.
wolfssl/​openssl/​ssl.h Simplifies cipher-suite identifiers.
wolfssl/​internal.h Simplifies CRL and DTLS constants.
wolfcrypt/​test/​test.c Simplifies test constants and a fallback macro.
wolfcrypt/​src/​random.c Simplifies request-size and hardware-address constants.
wolfcrypt/​src/​ecc.c Simplifies the GCM detection fallback macro.
tests/​api.c Simplifies static-memory test sizes.
src/​wolfio.c Simplifies the GNRC token-size constant.
src/​sniffer.c Simplifies key-log parsing length constants.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata -8 B, text +3,688 B (+1.3%, 286,152 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-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.

Fenrir Automated Review — PR #12072

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 17 of 19 in-scope changed file(s) opened by the reviewer; not opened: wolfssl/internal.h, wolfssl/quic.h

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants