This fixes compiler warnings when -Wunused-arguments is enabled and
not quieted.
Obtained from: Juniper Networks, Inc.
Differential D44623
vm: add macro to mark arguments used when NUMA is defined stevek on Apr 3 2024, 9:11 PM. Authored by Tags None Referenced Files
Subscribers
Details This fixes compiler warnings when -Wunused-arguments is enabled and Obtained from: Juniper Networks, Inc.
Diff Detail
Event TimelineComment Actions I have some bad feeling about all that <feature>_unused macros. Would it better to change it to unconditionally apply unused globall? Comment Actions I guess __unused has no effect if the compiler can observe that the annotated variable is in fact used? Maybe it would trigger warnings? I don't really like all the __unused aliases either, but I also don't want to just use __unused everywhere, it would be confusing. Comment Actions gcc manual describes the attribute((unused)) as possible unused, with the only mentioned consequence of gcc not issuing warning if really unused. Comment Actions I believe it only suppresses warnings that the compiler would generate. Although, it can sometimes confuse people when one flags an argument as unused, but it is actually used. Comment Actions Do you want me to just switch things to use __unused instead of the macros to conditionally add it? Comment Actions What about stub functions for !NUMA ? static inline int vm_page_domain(vm_page_t m) { #ifdef NUMA int domn, segind; segind = m->segind; KASSERT(segind < vm_phys_nsegs, ("segind %d m %p", segind, m)); domn = vm_phys_segs[segind].domain; KASSERT(domn >= 0 && domn < vm_ndomains, ("domain %d m %p", domn, m)); return (domn); #else return (0); #endif } to #ifdef NUMA static inline int vm_page_domain(vm_page_t m) { int domn, segind; segind = m->segind; KASSERT(segind < vm_phys_nsegs, ("segind %d m %p", segind, m)); domn = vm_phys_segs[segind].domain; KASSERT(domn >= 0 && domn < vm_ndomains, ("domain %d m %p", domn, m)); return (domn); } #else static inline int vm_page_domain(vm_page_t m __unused) { return (0); } #endif |