This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Enable -Werror=strict-prototypes by default
ClosedPublic

Authored by sunfish on Feb 20 2018, 5:20 PM.

Details

Reviewers
sbc100
Summary

WebAssembly, the architecture, is not designed to support unprototyped calling conventions. For example, clang tends to assume that it can use varargs to implement parts of the unprototyped function rules, which works on most other architectures, however WebAssembly has no straightforward way of allowing functions to be callable as both varargs and non-varargs. LLVM's backend does find ways to make things work in some cases, however the support is incomplete. To protect users from accidentally trying to compile such code and encountering bugs, this patch enables -Werror=strict-prototypes by default for the WebAssembly target.

Diff Detail

Repository
rL LLVM

Event Timeline

sunfish created this revision.Feb 20 2018, 5:20 PM
sbc100 accepted this revision.Feb 20 2018, 5:41 PM

Might want to line wrap your change description.

This revision is now accepted and ready to land.Feb 20 2018, 5:41 PM

Hmm.. actually this is probably going to break the waterfall pretty badly. But maybe we can fix it by re-disabling this explicitly when we build the gcc tests.

If someone is compiling C code that doesn't have undefined behavior, it should work; if it doesn't, that's a clear bug. (As far as I know, there shouldn't be any issues here, but if there are, file a bug and CC me.)

WebAssembly is not the only platform where varargs and non-varargs calls are incompatible. Some other popular platforms where this is a problem are 64-bit Windows and hard-float AArch32. So I don't think it makes sense to enable this specifically for one target.

sunfish added a comment.EditedJan 10 2019, 11:10 AM

With https://reviews.llvm.org/D48471 and related work, it's notnow less urgent to do this. And since there were objections to having target-specific warnings anyway, let's close this.

sunfish closed this revision.Jan 10 2019, 11:10 AM