commit dddc1f61c90cfd8dce44684c739c6e9242f43a72
parent c6c3fef5166e4061cab5a5959cfc7e10fc069def
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Wed, 3 Jun 2026 11:26:48 -0700
cc: drop chatty "ignoring accepted compatibility flag" log
The debug-only log fired for every accepted-but-ignored compatibility
flag (-Wall, -std=, -nostdlib, ...), drowning out real diagnostics. Drop
the cc_log_ignored() helper and its 10 call sites; the flags are still
accepted, now silently. Update the driver test to assert silent
acceptance (clean stderr) instead of the removed message.
Diffstat:
2 files changed, 6 insertions(+), 29 deletions(-)
diff --git a/driver/cmd/cc.c b/driver/cmd/cc.c
@@ -766,15 +766,6 @@ static int cc_record_mcmodel(CcOptions* o, const char* val) {
return 1;
}
-static void cc_log_ignored(const char* arg) {
-#ifndef NDEBUG
- driver_errf(CC_TOOL, "ignoring accepted compatibility flag: %.*s",
- KIT_SLICE_ARG(kit_slice_cstr(arg)));
-#else
- (void)arg;
-#endif
-}
-
static int cc_set_probe(CcOptions* o, int kind, const char* arg) {
if (o->probe_kind != CC_PROBE_NONE) {
driver_errf(CC_TOOL, "only one compiler-information probe is supported");
@@ -1201,7 +1192,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
continue;
}
if (driver_streq(a, "-v") || driver_streq(a, "-###")) {
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-E")) {
@@ -1252,7 +1242,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
driver_streq(a, "-Os") || driver_streq(a, "-Oz") ||
driver_streq(a, "-Ofast")) {
o->opt_level = 2;
- if (!driver_streq(a, "-O")) cc_log_ignored(a);
continue;
}
@@ -1262,7 +1251,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
}
if (driver_strneq(a, "-Werror=", 8)) {
o->warnings_are_errors = 1;
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-Wall") || driver_streq(a, "-Wextra") ||
@@ -1270,7 +1258,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
driver_streq(a, "-pedantic-errors") || driver_streq(a, "-w") ||
driver_strneq(a, "-Wno-", 5) ||
(driver_strneq(a, "-W", 2) && !driver_strneq(a, "-Wl,", 4))) {
- cc_log_ignored(a);
continue;
}
if (driver_strneq(a, "-fmax-errors=", 13)) {
@@ -1283,7 +1270,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
continue;
}
if (driver_strneq(a, "-std=", 5) || driver_streq(a, "-ansi")) {
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-ffreestanding")) {
@@ -1329,22 +1315,18 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
}
if (driver_streq(a, "-fno-builtin") || driver_streq(a, "-pipe") ||
driver_streq(a, "-pthread")) {
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-nostdlib")) {
o->no_stdlib = 1;
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-nodefaultlibs")) {
o->no_defaultlibs = 1;
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-nostartfiles")) {
o->no_startfiles = 1;
- cc_log_ignored(a);
continue;
}
if (driver_streq(a, "-isysroot") || driver_streq(a, "--sysroot")) {
@@ -1419,7 +1401,6 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
KIT_SLICE_ARG(kit_slice_cstr(a)));
return 1;
}
- cc_log_ignored(a);
continue;
}
diff --git a/test/driver/run.sh b/test/driver/run.sh
@@ -224,18 +224,14 @@ else
not_ok "cc-print-sysroot" "$work/cc-psysroot.diag"
fi
-# ---- accepted-but-ignored compatibility flags log to stderr ----
+# ---- accepted-but-ignored compatibility flags are silently accepted ----
if "$KIT" cc -Wall -Wextra -std=c11 -ffreestanding -c "$work/main.c" \
- -o "$work/ignored.o" > "$work/cc-ignored.out" 2> "$work/cc-ignored.err"; then
- if grep -q "ignoring accepted compatibility flag: -Wall" "$work/cc-ignored.err" &&
- grep -q "ignoring accepted compatibility flag: -std=c11" "$work/cc-ignored.err"; then
- ok "cc-ignored-compat-flags"
- else
- cp "$work/cc-ignored.err" "$work/cc-ignored.diag"
- not_ok "cc-ignored-compat-flags" "$work/cc-ignored.diag"
- fi
+ -o "$work/ignored.o" > "$work/cc-ignored.out" 2> "$work/cc-ignored.err" &&
+ [ -f "$work/ignored.o" ] && [ ! -s "$work/cc-ignored.err" ]; then
+ ok "cc-ignored-compat-flags"
else
- not_ok "cc-ignored-compat-flags" "$work/cc-ignored.err"
+ cp "$work/cc-ignored.err" "$work/cc-ignored.diag"
+ not_ok "cc-ignored-compat-flags" "$work/cc-ignored.diag"
fi
# ---- --output= long form (cc) ----