diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 339b75644a..ddfddee46d 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -1594,7 +1594,7 @@ plus_option(char *option, struct query *query, bool global) { FULLCHECK("yaml"); yaml = state; if (state) { - display_rrcomments = state; + display_rrcomments = 1; } break; case 'z': /* zflag */ diff --git a/cocci/implicit_casts_warning.spatch b/cocci/implicit_casts_warning.spatch new file mode 100644 index 0000000000..1f2e10cc91 --- /dev/null +++ b/cocci/implicit_casts_warning.spatch @@ -0,0 +1,56 @@ +@bool_into_int_warning@ +position p; +int i; +bool b; +@@ +i = b@p; + +@script:python@ +p << bool_into_int_warning.p; +@@ +report = coccilib.report.build_report(p[0], "WARNING: implicit bool->int cast on assignment") +sys.stderr.write(report) + + + +@return_isc_result_t_into_bool_warning@ +position p; +isc_result_t result; +identifier fn; +identifier literalresult =~ "ISC_R_.*|DNS_R_.*|DST_R_.*|ISCCC_R_.*"; +@@ +bool fn(...) { +<... +( +return result@p; +| +return literalresult@p; +) +...> +} + +@script:python@ +p << return_isc_result_t_into_bool_warning.p; +@@ +report = coccilib.report.build_report(p[0], "WARNING: implicit isc_result_t->bool cast on return value") +sys.stderr.write(report) + + + +@isc_result_t_into_bool_warning@ +position p; +isc_result_t result; +identifier literalresult =~ "ISC_R_.*|DNS_R_.*|DST_R_.*|ISCCC_R_.*"; +bool b; +@@ +( +b = result@p; +| +b = literalresult@p; +) + +@script:python@ +p << isc_result_t_into_bool_warning.p; +@@ +report = coccilib.report.build_report(p[0], "WARNING: implicit isc_result_t->bool cast on assignment") +sys.stderr.write(report) diff --git a/util/check-cocci.sh b/util/check-cocci.sh index 09783ea9af..f9f7acbbbb 100755 --- a/util/check-cocci.sh +++ b/util/check-cocci.sh @@ -23,7 +23,7 @@ run_spatch() { echo "Applying semantic patch $spatch..." spatch --jobs "${TEST_PARALLEL_JOBS:-1}" --sp-file "$spatch" --use-gitgrep --dir "." --include-headers $spatchargs >>"$patch" 2>cocci.stderr cat cocci.stderr - if grep -q -e "parse error" -e "EXN: Failure" cocci.stderr; then + if grep -q -e "parse error" -e "EXN: Failure" -e "WARNING" cocci.stderr; then ret=1 fi if [ "$(wc <"$patch" -l)" -gt "0" ]; then