This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Add missing #include <alloca.h>
AbandonedPublic

Authored by miyuki on Nov 2 2020, 7:52 AM.

Details

Reviewers
mstorsjo
danielkiss
Group Reviewers
Restricted Project
Summary

The macro/function alloca() is declared in <alloca.h> and in our
configuration it does not get included transitively from other
headers.

This patch adds #include <alloca.h> when alloca() is used.

Diff Detail

Event Timeline

miyuki created this revision.Nov 2 2020, 7:52 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 2 2020, 7:52 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
miyuki requested review of this revision.Nov 2 2020, 7:52 AM
miyuki edited the summary of this revision. (Show Details)
danielkiss accepted this revision.Nov 2 2020, 7:56 AM

LGTM, Thanks!

Unfortunately, not all these systems have an alloca.h, in particular, mingw doesn't.

miyuki added a comment.Nov 2 2020, 8:28 AM

I guess I'll leave it in our downstream version then.

miyuki abandoned this revision.Nov 2 2020, 8:29 AM
arichardson added inline comments.
libunwind/src/config.h
128

Couldn't this simply be changed to __builtin_alloca() to avoid the header dependency?

mstorsjo added inline comments.Mar 25 2021, 5:51 AM
libunwind/src/config.h
128

Within suitable ifdef __GNUC__ (possibly with some __has_builtin()), then maybe I guess that could be doable