Skip to content

Commit b60dbd6

Browse files
committed
avoid showing parasitic errors
1 parent 1e1c688 commit b60dbd6

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

compile_time_python/explain_compiler_output.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def explain_compiler_output(output, args):
106106
if explanation:
107107
explanations.append(explanation)
108108

109-
if run_compile_time_helper(message, args):
109+
if explanation and run_compile_time_helper(message, args):
110110
break
111111

112112
if not explanation_text:
@@ -127,8 +127,10 @@ def explain_compiler_output(output, args):
127127
#
128128
# if we didn't explain any messages, just pass through all compiler output
129129
#
130-
if not errors_explained and lines:
131-
print("\n".join(lines), file=sys.stderr)
130+
if not explanations and lines:
131+
message = "\n".join(lines)
132+
print(message, file=sys.stderr)
133+
run_compile_time_helper(message, args)
132134

133135
return explanations
134136

tests/expected_output/nonnull/000001-clang-14.0-x86_64-pc-linux-gnu.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@ tests/extracted_compile_time_errors/nonnull.c:5:5: warning: argument 2 null wher
44
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
dcc explanation: you are passing the variable pathname which always contains NULL as argument 2 to 'faccessat'.
66
Argument 2 to 'faccessat' should never be NULL.
7-
In file included from tests/extracted_compile_time_errors/nonnull.c:1:
8-
/usr/include/unistd.h:309:12: note: in a call to function ‘faccessat’ declared ‘nonnull’
9-
309 | extern int faccessat (int __fd, const char *__file, int __type, int __flag)
10-
| ^~~~~~~~~

tests/expected_output/write_null_stream/000001-clang-14.0-x86_64-pc-linux-gnu.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,3 @@ tests/run_time_errors/write_null_stream.c:4:9: warning: argument 1 null where no
44
| ^~~~~~~
55
dcc explanation: you are passing a NULL value as argument 1 to 'fprintf'.
66
Argument 1 to 'fprintf' should never be NULL.
7-
In file included from tests/run_time_errors/write_null_stream.c:1:
8-
/usr/include/stdio.h:350:12: note: in a call to function ‘fprintf’ declared ‘nonnull’
9-
350 | extern int fprintf (FILE *__restrict __stream,
10-
| ^~~~~~~
11-
tests/run_time_errors/write_null_stream.c:4:9: warning: argument 4 null where non-null expected [-Wnonnull]
12-
4 | fprintf(NULL, "Hello world\n");
13-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14-
tests/run_time_errors/write_null_stream.c:4:9: note: in a call to built-in function ‘__builtin_fwrite’

0 commit comments

Comments
 (0)