Skip to content

Commit 1e1c688

Browse files
committed
minor: remove newline from output
1 parent a217939 commit 1e1c688

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

compile_time_python/compile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ def add_tar_file(tar, pathname, contents):
587587

588588
MAX_BYTES_LOG_SOURCE_FILE = 20480
589589

590-
591590
def run_compile_time_logger(process, explanation_labels, options):
592591
"""
593592
run a script to log compiles
@@ -623,6 +622,8 @@ def run_compile_time_logger(process, explanation_labels, options):
623622
if options.debug:
624623
print(f"running {options.compile_logger}")
625624
try:
625+
sys.stdout.flush()
626+
sys.stderr.flush()
626627
subprocess.run([options.compile_logger])
627628
except OSError as e:
628629
if options.debug:

compile_time_python/explain_compiler_output.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ 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:
130+
if not errors_explained and lines:
131131
print("\n".join(lines), file=sys.stderr)
132132

133133
return explanations
@@ -275,6 +275,8 @@ def run_compile_time_helper(message, args):
275275
if args.debug:
276276
print(f"running {args.compile_helper}")
277277
try:
278+
sys.stdout.flush()
279+
sys.stderr.flush()
278280
p = subprocess.run([args.compile_helper])
279281
return p.returncode == 0
280282
except OSError as e:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tests/extracted_compile_time_errors/assign_function_to_int.c:2:9: warning: incompatible pointer to integer conversion initializing 'int' with an expression of type 'int (int, char **)' [-Wint-conversion]
2+
int a = main;
3+
^ ~~~~
4+
dcc explanation: you are attempting to assign main which is a function to an int variable.
5+
Perhaps you are trying to call the function and have forgotten the round brackets and any parameter values.
6+
7+
See more information here: https://comp1511unsw.github.io/dcc/assign_function_to_int.html
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tests/extracted_compile_time_errors/stack_use_after_return.c:3:13: warning: address of stack memory associated with local variable 'i' returned [-Wreturn-stack-address]
2+
return &i;
3+
^
4+
dcc explanation: you are trying to return a pointer to the local variable 'i'.
5+
You can not do this because i will not exist after the function returns.
6+
7+
See more information here: https://comp1511unsw.github.io/dcc/stack_use_after_return.html

0 commit comments

Comments
 (0)