[cfe-commits] [PATCH] Warning to help keep deprecation in comments and in attributes in sync

Dmitri Gribenko gribozavr at gmail.com
Sat Sep 15 11:48:13 PDT 2012


Hello,

@Doug: CC'ing you since you requested this.

The attached patch adds a warning for cases like:

/// Aaa
/// \deprecated
void test_deprecated_4(int a);

That is, comment has \deprecated but declaration does not have a
deprecation attribute (deprecated or unavailable).

This warning is under a separate flag,
-Wdocumentation-deprecated-not-sync, so it can be turned off easily
while leaving other -Wdocumentation warnings on.

I did not add a fix-it note because it would appear inconsistently:
1. in case the comment is attached to a declaration we can emit a fix-it easily;
2. in case the comment is attached to the function declaration that is
a definition, a whole new declaration needs to be added (because gcc
does not allow attributes on a function definition).

I don't think that we need to add a warning with reverse logic about
missing \deprecated, since documentation processing tools based on
clang should be smart enough to look at attributes.

Please review.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deprecated-not-sync-v1.patch
Type: application/octet-stream
Size: 3252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120915/f5315687/attachment.obj>


More information about the cfe-commits mailing list