Skip to content

Commit 19f0b3c

Browse files
author
v01dxyz
committed
Add warnings for a compartment call returning void to a DiagGroup
1 parent f7dd4ce commit 19f0b3c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@ def CHERIPrototypesStrict: DiagGroup<"cheri-prototypes-strict">;
158158
// Remarks about setting/not setting subobject bounds
159159
def CheriSubobjectBoundsSuspicous : DiagGroup<"cheri-subobject-bounds-suspicious">;
160160
def CheriSubobjectBoundsRemarks : DiagGroup<"cheri-subobject-bounds">;
161+
def CHERICompartmentReturnVoid : DiagGroup<"cheri-compartment-return-void">;
161162

162163
def CheriAll : DiagGroup<"cheri",
163164
[CHERICaps, CHERIBitwiseOps, CHERIMisaligned, CHERIImplicitConversion, CheriSubobjectBoundsSuspicous,
164-
CHERIProvenance, CHERIImplicitConversionSign, CHERIPrototypes]>;
165+
CHERIProvenance, CHERIImplicitConversionSign, CHERIPrototypes, CHERICompartmentReturnVoid]>;
165166
// CHERI warnings that are too noisy to turn on by default
166167
def CHERICapabilityToIntegerCast : DiagGroup<"capability-to-integer-cast">;
167168
def CheriPedantic : DiagGroup<"cheri-pedantic", [CHERICapabilityToIntegerCast, CHERIPrototypesStrict, CHERIProvenancePedantic]>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,10 +2337,12 @@ def note_in_reference_temporary_list_initializer : Note<
23372337
def note_var_fixit_add_initialization : Note<
23382338
"initialize the variable %0 to silence this warning">;
23392339
def warn_cheri_compartment_void_return_type : Warning <
2340-
"void return on a cross-compartment call make it impossible for callers to detect failure">;
2340+
"void return on a cross-compartment call make it impossible for callers to detect failure">,
2341+
InGroup<CHERICompartmentReturnVoid>;
23412342
def note_cheri_compartment_void_return_type : Note<"replace void return type with int">;
23422343
def warn_cheri_compartment_return_void_or_falloff : Warning <
2343-
"Cross-compartement calls that always succeed should return 0 instead">;
2344+
"Cross-compartement calls that always succeed should return 0 instead">,
2345+
InGroup<CHERICompartmentReturnVoid>;
23442346
def note_uninit_fixit_remove_cond : Note<
23452347
"remove the %select{'%1' if its condition|condition if it}0 "
23462348
"is always %select{false|true}2">;

0 commit comments

Comments
 (0)