Skip to content

profiler: Don't include alloca.h when disabled

Ting-Wei Lan requested to merge wip/lantw/include-alloca-h-conditionally into master

alloca is a non-standard feature. It is possible for a system to put it in a different header, so including alloca.h unconditionally may cause compilation error. Since we only need alloca when this Linux-only profiler is enabled, we can simply move the include to the ifdef block.

This is what I saw when compiling GJS on FreeBSD with --disable-profiler:

  CXX      gjs/libgjs_la-profiler.lo
/home/lantw44/gnome/source/gjs/gjs/profiler.cpp:27:10: fatal error: 'alloca.h' file not found
#include <alloca.h>
         ^~~~~~~~~~
1 error generated.
Edited by Ting-Wei Lan

Merge request reports