Accept -fno-knr-functions as a driver flag as well

Due to a think-o, it was only being accepted as a -cc1 flag. This adds
the proper forwarding from the driver to the frontend and adds test
coverage for the option.
This commit is contained in:
Aaron Ballman 2022-04-30 13:36:59 -04:00
parent e098281c27
commit 786954db06
2 changed files with 6 additions and 0 deletions

View File

@ -5311,6 +5311,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Freestanding)
CmdArgs.push_back("-ffreestanding");
Args.AddLastArg(CmdArgs, options::OPT_fno_knr_functions);
// This is a coarse approximation of what llvm-gcc actually does, both
// -fasynchronous-unwind-tables and -fnon-call-exceptions interact in more
// complicated ways.

View File

@ -7,5 +7,9 @@
// RUN: not %clang -fknr-functions -x c %s 2>&1 | FileCheck --check-prefixes=POS %s
// RUN: not %clang -fknr-functions -std=c89 -x c %s 2>&1 | FileCheck --check-prefixes=POS %s
// Ensure that the driver flag is actually accepted though.
// RUN: %clang -fno-knr-functions -### %s 2>&1 | FileCheck --check-prefixes=ACCEPTED %s
// NONO: error: unknown argument: '-fno-no-knr-functions'
// POS: error: unknown argument: '-fknr-functions'
// ACCEPTED-NOT: warning: argument unused during compilation: '-fno-knr-functions'