library: fix 'smaps' bug preventing a build with clang

As a result of the issue referenced below, we'll trade
our homegrown offset generator for an 'offsetof' macro
found in the stddef.h header file. This pleases clang.

[ and thanks to Daniel Kolesa for the report and fix ]

Reference(s):
. bug report & recommended solution
https://gitlab.com/procps-ng/procps/-/issues/235

. clang error message
proc/readproc.c:673:9: error: initializer element is not a compile-time constant
        mkENT(Rss),
        ^~~~~~~~~~
proc/readproc.c:661:34: note: expanded from macro 'mkENT'
  #define mkENT(F) { #F ":", -1, (int)((void*)&q->smap_ ## F - (void*)&q->fZERO) }
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2022-04-10 00:00:00 -05:00
committed by Craig Small
parent 7279cd8e4d
commit 9e77e138c1
2 changed files with 3 additions and 2 deletions

1
NEWS
View File

@ -4,6 +4,7 @@ procps-ng-NEXT
* ps: threads again display when -L is used with -q issue #234
* ps: proper aix format string behavior was restored
* sysctl: print dotted keys again
* top: fix 'smaps' bug preventing build under clang issue #235
procps-ng-4.0.0
---------------