@@ -11386,6 +11386,10 @@ def err_bounds_type_annotation_lost_checking : Error<
11386
11386
"argument has unknown bounds, bounds expected because the "
11387
11387
"%ordinal0 parameter has bounds">;
11388
11388
11389
+ def err_expected_bounds_for_return : Error<
11390
+ "return value has unknown bounds, bounds expected because the "
11391
+ "function %0 has bounds">;
11392
+
11389
11393
def err_initializer_expected_with_bounds : Error<
11390
11394
"automatic variable %0 with bounds must have initializer">;
11391
11395
@@ -11507,7 +11511,7 @@ def err_bounds_type_annotation_lost_checking : Error<
11507
11511
"variable arguments function cannot be made in a checked scope">;
11508
11512
11509
11513
def err_checked_scope_no_variadic_func_for_expression : Error<
11510
- "cannot use a variable arguments function in a checked scope or function">;
11514
+ "cannot use this variable arguments function in a checked scope or function">;
11511
11515
11512
11516
def err_checked_scope_no_assume_bounds_casting : Error<
11513
11517
"_Assume_bounds_cast not allowed in a checked scope or function">;
@@ -11520,6 +11524,12 @@ def err_bounds_type_annotation_lost_checking : Error<
11520
11524
"%select{'_Unchecked'|'_Checked _Bounds_only|'_Checked'}0 "
11521
11525
"can only appear on functions">;
11522
11526
11527
+ def err_checked_scope_invalid_format_specifier_argument : Error<
11528
+ "in a checked scope %0 format specifier requires %1 argument">;
11529
+
11530
+ def err_checked_scope_scanf_width : Error<
11531
+ "in a checked scope width is not allowed with format specifier in scanf">;
11532
+
11523
11533
def err_pragma_pop_checked_scope_mismatch : Error<
11524
11534
"#pragma CHECKED_SCOPE pop with no matching #pragma CHECKED_SCOPE push">;
11525
11535
@@ -11619,8 +11629,32 @@ def err_bounds_type_annotation_lost_checking : Error<
11619
11629
def error_static_cast_bounds_invalid : Error<
11620
11630
"cast source bounds are too narrow for %0">;
11621
11631
11632
+ def error_modified_return_bounds : Error<
11633
+ "modified expression '%0' used in the declared return bounds for %1">;
11634
+
11635
+ def error_return_bounds_invalid : Error<
11636
+ "return value bounds do not imply declared return bounds for %0">;
11637
+
11638
+ def error_return_bounds_unprovable: Error<
11639
+ "it is not possible to prove that return value bounds "
11640
+ "imply declared return bounds for %0">;
11641
+
11642
+ def warn_return_bounds_invalid: Warning<
11643
+ "cannot prove return value bounds imply declared return bounds for %0">,
11644
+ InGroup<CheckBoundsDeclsUnchecked>;
11645
+
11646
+ def warn_checked_scope_return_bounds_invalid : Warning<
11647
+ "cannot prove return value bounds imply declared return bounds for %0">,
11648
+ InGroup<CheckBoundsDeclsChecked>;
11649
+
11650
+ def note_declared_return_bounds : Note<
11651
+ "(expanded) declared return bounds are '%0'">;
11652
+
11653
+ def note_inferred_return_bounds : Note<
11654
+ "(expanded) inferred return value bounds are '%0'">;
11655
+
11622
11656
def error_out_of_bounds_access : Error<
11623
- "out-of-bounds %select{||memory access|base value}0">;
11657
+ "out-of-bounds %select{||| memory access|base value}0">;
11624
11658
11625
11659
def note_source_bounds_empty : Note<"source bounds are an empty range">;
11626
11660
@@ -11631,21 +11665,22 @@ def err_bounds_type_annotation_lost_checking : Error<
11631
11665
def note_destination_bounds_invalid : Note<"destination bounds are an invalid range">;
11632
11666
11633
11667
def note_bounds_too_narrow : Note<
11634
- "%select{destination bounds are|target bounds are|memory accessed is |"
11635
- "struct/union pointed to by base is}0 wider than the "
11636
- "%select{source|source|| }0 bounds">;
11668
+ "%select{destination bounds are|target bounds are|declared return bounds are |"
11669
+ "memory accessed is| struct/union pointed to by base is| }0 wider "
11670
+ "than the %select{source|source|return value|source|source }0 bounds">;
11637
11671
11638
11672
def note_lower_out_of_bounds : Note<
11639
- "%select{destination lower bound is|target lower bound is|accesses memory|"
11640
- "base value is}0 below %select{source|source|the|its}0 lower bound">;
11673
+ "%select{destination lower bound is|target lower bound is|"
11674
+ "declared return lower bound is|accesses memory|base value is}0 "
11675
+ "below %select{source|source|return value|the|its}0 lower bound">;
11641
11676
11642
11677
def note_upper_out_of_bounds : Note<
11643
11678
"%select{destination upper bound is|target upper bound is|"
11644
- "accesses memory at or|base value is}0 "
11645
- "above %select{source|source|the|its}0 upper bound">;
11679
+ "declared return upper bound is| accesses memory at or|base value is}0 "
11680
+ "above %select{source|source|return value| the|its}0 upper bound">;
11646
11681
11647
11682
def note_bounds_partially_overlap : Note<
11648
- "%select{||accesses memory that|struct/union pointed to by base value}0 is "
11683
+ "%select{||| accesses memory that|struct/union pointed to by base value}0 is "
11649
11684
"only partially in bounds">;
11650
11685
11651
11686
def no_prototype_generic_function : Error<
@@ -11680,5 +11715,75 @@ def err_bounds_type_annotation_lost_checking : Error<
11680
11715
def err_expanding_cycle : Error<
11681
11716
"expanding cycle in struct definition">;
11682
11717
11718
+ // -Wformat warnings issued as errors in checked scope.
11719
+ def err_format_nonliteral_noargs : Error<
11720
+ "format string is not a string literal (potentially insecure)">;
11721
+ def err_format_nonliteral : Error<
11722
+ "format string is not a string literal">;
11723
+ def err_printf_insufficient_data_args : Error<
11724
+ "more '%%' conversions than data arguments">;
11725
+ def err_printf_data_arg_not_used : Error<
11726
+ "data argument not used by format string">;
11727
+ def err_format_invalid_conversion : Error<
11728
+ "invalid conversion specifier '%0'">;
11729
+ def err_printf_incomplete_specifier : Error<
11730
+ "incomplete format specifier">;
11731
+ def err_missing_format_string : Error<
11732
+ "format string missing">;
11733
+ def err_scanf_nonzero_width : Error<
11734
+ "zero field width in scanf format string is unused">;
11735
+ def err_format_conversion_argument_type_mismatch : Error<
11736
+ "format specifies type %0 but the argument has "
11737
+ "%select{type|underlying type}2 %1">;
11738
+ def err_format_conversion_argument_type_mismatch_pedantic : Error<
11739
+ err_format_conversion_argument_type_mismatch.Text>;
11740
+ def err_format_conversion_argument_type_mismatch_confusion : Error<
11741
+ err_format_conversion_argument_type_mismatch.Text>;
11742
+ def err_format_argument_needs_cast : Error<
11743
+ "%select{values of type|enum values with underlying type}2 '%0' should not "
11744
+ "be used as format arguments; add an explicit cast to %1 instead">;
11745
+ def err_format_argument_needs_cast_pedantic : Error<
11746
+ err_format_argument_needs_cast.Text>;
11747
+ def err_printf_positional_arg_exceeds_data_args : Error <
11748
+ "data argument position '%0' exceeds the number of data arguments (%1)">;
11749
+ def err_format_invalid_positional_specifier : Error<
11750
+ "invalid position specified for %select{field width|field precision}0">;
11751
+ def err_format_mix_positional_nonpositional_args : Error<
11752
+ "cannot mix positional and non-positional arguments in format string">;
11753
+ def err_empty_format_string : Error<
11754
+ "format string is empty">;
11755
+ def err_format_string_is_wide_literal : Error<
11756
+ "format string should not be a wide string">;
11757
+ def err_printf_format_string_contains_null_char : Error<
11758
+ "format string contains '\\0' within the string body">;
11759
+ def err_printf_format_string_not_null_terminated : Error<
11760
+ "format string is not null-terminated">;
11761
+ def err_printf_asterisk_missing_arg : Error<
11762
+ "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">;
11763
+ def err_printf_asterisk_wrong_type : Error<
11764
+ "field %select{width|precision}0 should have type %1, but argument has type %2">;
11765
+ def err_printf_nonsensical_optional_amount: Error<
11766
+ "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">;
11767
+ def err_printf_nonsensical_flag: Error<
11768
+ "flag '%0' results in undefined behavior with '%1' conversion specifier">;
11769
+ def err_format_nonsensical_length: Error<
11770
+ "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">;
11771
+ def err_format_non_standard_positional_arg: Error<
11772
+ "positional arguments are not supported by ISO C">;
11773
+ def err_format_non_standard: Error<
11774
+ "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">;
11775
+ def err_format_non_standard_conversion_spec: Error<
11776
+ "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">;
11777
+ def err_format_invalid_annotation : Error<
11778
+ "using '%0' format specifier annotation outside of os_log()/os_trace()">;
11779
+ def err_format_P_no_precision : Error<
11780
+ "using '%%P' format specifier without precision">;
11781
+ def err_printf_ignored_flag: Error<
11782
+ "flag '%0' is ignored when flag '%1' is present">;
11783
+ def err_scanf_scanlist_incomplete : Error<
11784
+ "no closing ']' for '%%[' in scanf format string">;
11785
+ def err_format_bool_as_character : Error<
11786
+ "using '%0' format specifier, but argument has boolean value">;
11787
+
11683
11788
} // end of Checked C Category
11684
11789
} // end of sema component.
0 commit comments