Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -4128,7 +4128,8 @@ def err_feature_invalid_for_decl : Error<
def err_feature_merge_incompatible : Error<
"cannot merge incompatible feature attribute to this decl">;
def warn_new_feature_redeclaration : Warning<
"new domain availability attributes cannot be added to redeclarations">, DefaultError;
"new domain availability attributes cannot be added to redeclarations">,
InGroup<DiagGroup<"domain-availability-redeclaration">>, DefaultError;
def err_feature_invalid_added : Error<
"cannot add feature availability to this decl">;
def note_feature_incompatible0 : Note<
Expand Down
9 changes: 5 additions & 4 deletions clang/test/Sema/feature-availability.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple arm64-apple-macosx15 -fblocks -ffeature-availability=feature1:1 -ffeature-availability=feature2:0 -ffeature-availability=feature3:on -fsyntax-only -Wunreachable-code -verify %s
// RUN: %clang_cc1 -triple arm64-apple-macosx15 -fblocks -fsyntax-only -Wunreachable-code -verify -DUSE_DOMAIN %s
// RUN: %clang_cc1 -triple arm64-apple-macosx15 -fblocks -ffeature-availability=feature1:1 -ffeature-availability=feature2:0 -ffeature-availability=feature3:on -fsyntax-only -Wunreachable-code -verify=expected,redecl %s
// RUN: %clang_cc1 -triple arm64-apple-macosx15 -fblocks -ffeature-availability=feature1:1 -ffeature-availability=feature2:0 -ffeature-availability=feature3:on -fsyntax-only -Wunreachable-code -Wno-domain-availability-redeclaration -verify=expected %s
// RUN: %clang_cc1 -triple arm64-apple-macosx15 -fblocks -fsyntax-only -Wunreachable-code -verify=expected,redecl -DUSE_DOMAIN %s

#include <availability_domain.h>

Expand Down Expand Up @@ -75,12 +76,12 @@ void (* __attribute__((availability(domain:feature2, AVAIL))) fp3)(void) = func6
void func6(void);
__attribute__((availability(domain:feature1, AVAIL))) void func6(void); // expected-note {{is incompatible with __attribute__((availability(domain:feature1, 0)))}}
__attribute__((availability(domain:feature1, UNAVAIL))) void func6(void); // expected-error {{cannot merge incompatible feature attribute to this decl}} expected-note {{feature attribute __attribute__((availability(domain:feature1, 1)))}}
__attribute__((availability(domain:feature1, AVAIL))) void func8(void); // expected-error {{new domain availability attributes cannot be added to redeclarations}}
__attribute__((availability(domain:feature1, AVAIL))) void func8(void); // redecl-error {{new domain availability attributes cannot be added to redeclarations}}

int g0;
__attribute__((availability(domain:feature1, AVAIL))) int g0; // expected-note {{is incompatible with __attribute__((availability(domain:feature1, 0)))}}
__attribute__((availability(domain:feature1, UNAVAIL))) int g0; // expected-error {{cannot merge incompatible feature attribute to this decl}} expected-note {{feature attribute __attribute__((availability(domain:feature1, 1)))}}
__attribute__((availability(domain:feature1, AVAIL))) int g2;// expected-error {{new domain availability attributes cannot be added to redeclarations}}
__attribute__((availability(domain:feature1, AVAIL))) int g2;// redecl-error {{new domain availability attributes cannot be added to redeclarations}}

typedef int INT0 __attribute__((availability(domain:feature2, AVAIL)));
typedef INT0 INT1 __attribute__((availability(domain:feature2, AVAIL)));
Expand Down