This is an archive of the discontinued LLVM Phabricator instance.

[builtins] Unbreak build on FreeBSD armv7 after D60351
ClosedPublic

Authored by jbeich on Sep 25 2019, 12:21 PM.

Details

Reviewers
phosek
echristo
Summary

According to FreeBSD style(9) and OpenBSD style(9) either <sys/types.h> or <sys/param.h> must come before any other header. Many system headers are not self-sufficient to avoid namespace pollution.

Found downstream via Rust

# FreeBSD
$ echo '#include <machine/sysarch.h>' | cc -xc -
In file included from <stdin>:1:
In file included from /usr/include/machine/sysarch.h:42:
/usr/include/machine/armreg.h:47:2: error: Please include sys/cdefs.h before including machine/armreg.h
#error Please include sys/cdefs.h before including machine/armreg.h
 ^
1 error generated.

# OpenBSD
$ echo '#include <machine/sysarch.h>' | cc -xc -
In file included from <stdin>:1:
/usr/include/machine/sysarch.h:47: error: expected specifier-qualifier-list before 'u_int32_t'
In file included from <stdin>:1:
/usr/include/machine/sysarch.h:56: error: expected ')' before 'addr'

Event Timeline

jbeich created this revision.Sep 25 2019, 12:21 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 25 2019, 12:21 PM
Herald added subscribers: llvm-commits, Restricted Project, jfb and 3 others. · View Herald Transcript
phosek accepted this revision.Sep 28 2019, 2:22 PM

LGTM

This revision is now accepted and ready to land.Sep 28 2019, 2:22 PM
jbeich edited the summary of this revision. (Show Details)Oct 8 2019, 12:25 AM
jbeich added a comment.Oct 8 2019, 6:56 AM

Can someone land this change? Only tested on FreeBSD because contributing guide didn't cover how to elsewhere i.e., on platforms one doesn't have access to.

Can someone land this change? Only tested on FreeBSD because contributing guide didn't cover how to elsewhere i.e., on platforms one doesn't have access to.

Merged now.

dim closed this revision.Oct 8 2019, 9:57 AM

For some reason this didn't get closed by Phabricator. Committed in rCRT374070.