Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wdocumentation] Use C2x/C++14 deprecated attribute
This replaces the non-standard __attribute__((deprecated)) with the standard [[deprecated]] when compiling in C2x/C++14 mode. Discovered while looking at https://bugs.llvm.org/show_bug.cgi?id=43753 Differential Revision: https://reviews.llvm.org/D71141
- Loading branch information
Showing
4 changed files
with
86 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -verify %s | ||
// RUN %clang_cc1 -std=c18 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -DATTRIBUTE="__attribute__((deprecated))" %s | ||
// RUN: %clang_cc1 -std=c2x -DC2x -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK2x -DATTRIBUTE="[[deprecated]]" %s | ||
|
||
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} | ||
/// \deprecated | ||
void test_deprecated_1(); | ||
|
||
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} | ||
/// \deprecated | ||
void test_deprecated_2(int a); | ||
|
||
#define MY_ATTR_DEPRECATED __attribute__((deprecated)) | ||
|
||
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} | ||
/// \deprecated | ||
void test_deprecated_3(int a); | ||
|
||
#ifdef C2x | ||
#define ATTRIBUTE_DEPRECATED [[deprecated]] | ||
|
||
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} | ||
/// \deprecated | ||
void test_deprecated_4(int a); | ||
#endif | ||
|
||
// CHECK: fix-it:"{{.*}}":{7:1-7:1}:"[[ATTRIBUTE]] " | ||
// CHECK: fix-it:"{{.*}}":{11:1-11:1}:"[[ATTRIBUTE]] " | ||
// CHECK: fix-it:"{{.*}}":{17:1-17:1}:"MY_ATTR_DEPRECATED " | ||
// CHECK2x: fix-it:"{{.*}}":{24:1-24:1}:"ATTRIBUTE_DEPRECATED " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters