diff mbox series

cgcc: check sparse options fmax-errors and fmax-warnings

Message ID 20240903061257.648402-1-dmitrii.golovanov@intel.com (mailing list archive)
State New
Headers show
Series cgcc: check sparse options fmax-errors and fmax-warnings | expand

Commit Message

Dmitrii Golovanov Sept. 3, 2024, 6:12 a.m. UTC
Recognize sparse command-line options `-fmax-errors` and `-fmax-warnings`
as "check" options:

  `-fmax-warnings` - dont pass it to CC neither with integer value,
    nor as 'unlimited'.
  `-fmax-errors` - only as 'unlimited' value to avoid 'unrecognized
    command-line option' GCC error which also accepts it as numeric.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
---
 cgcc | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 618ba08a..b90e9428 100755
--- a/cgcc
+++ b/cgcc
@@ -129,6 +129,8 @@  sub check_only_option {
     return 1 if $arg =~ /^-W(no-?)?(address-space|bitwise|cast-to-as|cast-truncate|constant-suffix|context|decl|default-bitfield-sign|designated-init|do-while|enum-mismatch|external-function-has-definition|init-cstring|memcpy-max-count|non-pointer-null|old-initializer|one-bit-signed-bitfield|override-init-all|paren-string|ptr-subtraction-blows|return-void|sizeof-bool|sparse-all|sparse-error|transparent-union|typesign|undef|unknown-attribute)$/;
     return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/;
     return 1 if $arg =~ /^-f(dump-ir|memcpy-max-count|diagnostic-prefix)(=\S*)?$/;
+    return 1 if $arg =~ /^-fmax-errors=unlimited$/;  # don't pass it to GCC
+    return 1 if $arg =~ /^-fmax-warnings=(unlimited|[0-9]+)$/;
     return 1 if $arg =~ /^-f(mem2reg|optim)(-enable|-disable|=last)?$/;
     return 1 if $arg =~ /^-msize-(long|llp64)$/;
     return 0;