Skip to content

smaps2proc in proc/readproc.c is not valid C and does not build under clang

The smaptab is static but its values refer to addresses from the P argument. Nevermind that, I switched up the two macros. However, it's not valid for initializer entries of a static variable to not be constants.

../proc/readproc.c:670:9: error: initializer element is not a compile-time constant
        mkENT(Rss),
        ^~~~~~~~~~
../proc/readproc.c:658:34: note: expanded from macro 'mkENT'
  #define mkENT(F) { #F ":", -1, (int)((void*)&q->smap_ ## F - (void*)&q->fZERO) }
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edited by nina