Skip to content

Commit

Permalink
Add warnings for a compartment call returning void to a DiagGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
v01dxyz committed Dec 12, 2024
1 parent f007235 commit 66b2672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ def CHERIPrototypesStrict: DiagGroup<"cheri-prototypes-strict">;
// Remarks about setting/not setting subobject bounds
def CheriSubobjectBoundsSuspicous : DiagGroup<"cheri-subobject-bounds-suspicious">;
def CheriSubobjectBoundsRemarks : DiagGroup<"cheri-subobject-bounds">;
def CHERICompartmentReturnVoid : DiagGroup<"cheri-compartment-return-void">;

def CheriAll : DiagGroup<"cheri",
[CHERICaps, CHERIBitwiseOps, CHERIMisaligned, CHERIImplicitConversion, CheriSubobjectBoundsSuspicous,
CHERIProvenance, CHERIImplicitConversionSign, CHERIPrototypes]>;
CHERIProvenance, CHERIImplicitConversionSign, CHERIPrototypes, CHERICompartmentReturnVoid]>;
// CHERI warnings that are too noisy to turn on by default
def CHERICapabilityToIntegerCast : DiagGroup<"capability-to-integer-cast">;
def CheriPedantic : DiagGroup<"cheri-pedantic", [CHERICapabilityToIntegerCast, CHERIPrototypesStrict, CHERIProvenancePedantic]>;
Expand Down
6 changes: 4 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -2337,10 +2337,12 @@ def note_in_reference_temporary_list_initializer : Note<
def note_var_fixit_add_initialization : Note<
"initialize the variable %0 to silence this warning">;
def warn_cheri_compartment_void_return_type : Warning <
"void return on a cross-compartment call make it impossible for callers to detect failure">;
"void return on a cross-compartment call make it impossible for callers to detect failure">,
InGroup<CHERICompartmentReturnVoid>;
def note_cheri_compartment_void_return_type : Note<"replace void return type with int">;
def warn_cheri_compartment_return_void_or_falloff : Warning <
"Cross-compartement calls that always succeed should return 0 instead">;
"Cross-compartement calls that always succeed should return 0 instead">,
InGroup<CHERICompartmentReturnVoid>;
def note_uninit_fixit_remove_cond : Note<
"remove the %select{'%1' if its condition|condition if it}0 "
"is always %select{false|true}2">;
Expand Down

0 comments on commit 66b2672

Please sign in to comment.