This is an archive of the discontinued LLVM Phabricator instance.

Add warning for attribute-cleanup on function parameter.
ClosedPublic

Authored by comex on Dec 9 2015, 10:33 PM.

Details

Summary

When a function parameter is declared __attribute__((cleanup)), neither Clang nor GCC actually executes the cleanup function, but Clang didn't warn about it. For the sake of compatibility, add a warning rather than making the attribute actually work.

Diff Detail

Event Timeline

comex updated this revision to Diff 42389.Dec 9 2015, 10:33 PM
comex retitled this revision from to Add warning for attribute-cleanup on function parameter..
comex updated this object.
comex added a subscriber: cfe-commits.
rsmith accepted this revision.Dec 10 2015, 4:10 PM
rsmith added a reviewer: rsmith.
rsmith added a subscriber: rsmith.

This looks fine to me, though it would be better to express the restrictions as a SubjectList on the attribute definition in include/clang/Basic/Attr.td rather than here in code.

This revision is now accepted and ready to land.Dec 10 2015, 4:10 PM
aaron.ballman accepted this revision.Dec 10 2015, 4:33 PM
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a subscriber: aaron.ballman.

This looks fine to me, though it would be better to express the restrictions as a SubjectList on the attribute definition in include/clang/Basic/Attr.td rather than here in code.

It would be nice, but the issue is the unwieldy list of diagnostic enumerations for custom subject lists. I would love to find a way to express the diagnostic replacement for %1 as part of tablegen instead of manually.

FWIW, this LGTM as well.

~Aaron

aaron.ballman closed this revision.Dec 1 2017, 8:54 AM

I committed a different fix for this in r319555.