From 66b26725bc889f133f42bc40fe7a6f7db8510b33 Mon Sep 17 00:00:00 2001 From: v01dxyz Date: Thu, 12 Dec 2024 11:58:34 +0100 Subject: [PATCH] Add warnings for a compartment call returning void to a DiagGroup --- clang/include/clang/Basic/DiagnosticGroups.td | 3 ++- clang/include/clang/Basic/DiagnosticSemaKinds.td | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 8be758c87324..48fe078ee400 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -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]>; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 0a49706c9934..c21aa9d465e7 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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; 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; def note_uninit_fixit_remove_cond : Note< "remove the %select{'%1' if its condition|condition if it}0 " "is always %select{false|true}2">;