[build failure] clang 23: static variables "set but not used" in httpserv.c, selfserv.c, javascript.c
Categories
(NSS :: Build, defect, P1)
Tracking
(Not tracked)
People
(Reporter: guillaume-mozilla, Assigned: jschanck)
References
Details
(Whiteboard: [nss-nofx])
Attachments
(1 external file)
Steps to reproduce
Building the 3.130 tarball with BUILD_OPT=1, clang 23.1.1 as a compiler
Actual results
httpserv.c:58:25: error: variable 'lm' set but not used [-Werror,-Wunused-but-set-global]
httpserv.c:141:12: error: variable 'threadCount' set but not used [-Werror,-Wunused-but-set-global]
Expected results
Compilation was expected not to stop on this error.
It seems unused-but-set-global became default with clang 23, thus this error probably went unnoticed before it.
threadCount only gets used in an assert (which is discarded on optimized builds),
lm is used in the VLOG macro (same discarding).
#ifdef PR_LOGGING may be the solution to lm,
#if defined(DEBUG) || defined(FORCE_PR_ASSERT) for threadCount
| Reporter | ||
Updated•1 month ago
|
| Reporter | ||
Comment 1•1 month ago
|
||
There were errors as well on:
cmd/selfserv/selfserv.c:lm,opsPerSec,previousOps
(lm: as inhttpserv.c, both others: as forthreadCount)cmd/signtool/javascript.c:jartree
(I simply removed it, it seemed here "for future use")
Here is my full source fixer, allowing NSS to compile:
for f in cmd/httpserv/httpserv.c cmd/selfserv/selfserv.c
do
filtrer "$f" sed -E -e '/threadCount[^A-Z]|opsPerSec|previousOps/{
i\
#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
a\
#endif
}' -e '/LogModule.*lm|lm.*LogModule/{
i\
#ifdef PR_LOGGING
a\
#endif
}'
done
filtrer cmd/signtool/javascript.c grep -v jartree
(filtrer() is my in-place filtering shell function, filtrer $f sed … working like a sed -i)
| Reporter | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 2•12 days ago
|
||
Updated•12 days ago
|
Updated•8 days ago
|
Pushed by nkulatova@mozilla.com:
https://hg.mozilla.org/projects/nss/rev/c732fc8dc551
Fix -Wunused-but-set-global errors with clang 23 in httpserv and selfserv r=crypto-reviewers,jschanck
Description
•