Skip to content

Commit db89983

Browse files
committed
[CHERIoT] Make cheriot_use_of_builtin_sealing_key_type_no_compartment a warning that defaults to Error level
1 parent bfb9e86 commit db89983

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def CheriPedantic : DiagGroup<"cheri-pedantic", [CHERICapabilityToIntegerCast, C
172172
// Warnings/Errors for bugs in the MIPS/CHERI backend
173173
def MIPSCHERIBugs: DiagGroup<"mips-cheri-bugs">;
174174

175+
// Generally useful CHERI errors
176+
def CHERIMissingCompartment: DiagGroup<"cheri-missing-compartment">;
177+
175178
def C99Compat : DiagGroup<"c99-compat">;
176179
def C23Compat : DiagGroup<"c23-compat">;
177180
def : DiagGroup<"c2x-compat", [C23Compat]>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def err_cheriot_invalid_sealed_declaration
157157
: Error<"cannot declare a sealed variable as %0">;
158158
def err_cheriot_invalid_sealing_key_type_name
159159
: Error<"the sealing key type name '%0' is not a valid identifier">;
160-
def err_cheriot_use_of_builtin_sealing_key_type_no_compartment
161-
: Error<"%0 used, but no compartment name given">;
160+
def warn_cheriot_use_of_builtin_sealing_key_type_no_compartment
161+
: Warning<"%0 used, but no compartment name given">,InGroup<CHERIMissingCompartment>,DefaultError;
162162

163163
// C99 variable-length arrays
164164
def ext_vla : Extension<"variable length arrays are a C99 feature">,

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
29382938
}
29392939
if (getLangOpts().CheriCompartmentName.empty()) {
29402940
Diag(Arg->getExprLoc(),
2941-
diag::err_cheriot_use_of_builtin_sealing_key_type_no_compartment)
2941+
diag::warn_cheriot_use_of_builtin_sealing_key_type_no_compartment)
29422942
<< Context.BuiltinInfo.getName(
29432943
Builtin::BI__builtin_cheriot_sealing_type);
29442944
}

0 commit comments

Comments
 (0)