Skip to content

Commit 7b320ba

Browse files
committed
custom output flag
1 parent 168d7ab commit 7b320ba

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

app/src/main/java/com/duy/ccppcompiler/compiler/GCCCompiler.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,24 @@ public ShellResult compile(File[] sourceFiles) {
8585

8686
private ArrayList<String> getUserFlags() {
8787
ArrayList<String> flags = new ArrayList<>();
88-
flags.add("-fdiagnostics-show-location=every-line");
88+
// Emit fix-it hints in a machine-parseable format, suitable for consumption by IDEs.
89+
// For each fix-it, a line will be printed after the relevant diagnostic, starting with the
90+
// string “fix-it:”. For example:
91+
// fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
92+
flags.add("-fdiagnostics-parseable-fixits");
93+
94+
// By default, each diagnostic emitted includes text indicating the command-line option that
95+
// directly controls the diagnostic (if such an option is known to the diagnostic machinery).
96+
// Specifying the -fno-diagnostics-show-option flag suppresses that behavior.
97+
flags.add("-fno-diagnostics-show-option");
98+
99+
// By default, each diagnostic emitted includes the original source line and a caret ‘^’
100+
// indicating the column. This option suppresses this information. The source line is
101+
// truncated to n characters, if the -fmessage-length=n option is given. When the output is
102+
// done to the terminal, the width is limited to the width given by the COLUMNS environment
103+
// variable or, if not set, to the terminal width.
104+
flags.add("-fno-diagnostics-show-caret");
105+
89106
return flags;
90107
}
91108
}

0 commit comments

Comments
 (0)