From: Jakub Jelinek Date: Thu, 7 Dec 2023 08:47:54 +0000 (+0100) Subject: c-family: Fix up -fno-debug-cpp [PR111965] X-Git-Tag: basepoints/gcc-15~3873 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c088c4307dbb855596acb6366b0882e95d20b91;p=thirdparty%2Fgcc.git c-family: Fix up -fno-debug-cpp [PR111965] As can be seen in the second testcase, -fno-debug-cpp is actually implemented the same as -fdebug-cpp and so doesn't turn the debugging off. The following patch fixes that. 2023-12-07 Andrew Pinski Jakub Jelinek PR preprocessor/111965 gcc/c-family/ * c-opts.cc (c_common_handle_option) : Set cpp_opts->debug to value rather than 1. gcc/testsuite/ * gcc.dg/cpp/pr111965-1.c: New test. * gcc.dg/cpp/pr111965-2.c: New test. --- diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index 60aa7c5fd430..0399899387f7 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -532,7 +532,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, break; case OPT_fdebug_cpp: - cpp_opts->debug = 1; + cpp_opts->debug = value; break; case OPT_ftrack_macro_expansion: diff --git a/gcc/testsuite/gcc.dg/cpp/pr111965-1.c b/gcc/testsuite/gcc.dg/cpp/pr111965-1.c new file mode 100644 index 000000000000..97900552a4c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr111965-1.c @@ -0,0 +1,5 @@ +/* PR preprocessor/111965 + { dg-do preprocess } + { dg-options "-fdebug-cpp" } + { dg-final { scan-file pr111965-1.i "P:;F:;" } } */ +int x; diff --git a/gcc/testsuite/gcc.dg/cpp/pr111965-2.c b/gcc/testsuite/gcc.dg/cpp/pr111965-2.c new file mode 100644 index 000000000000..44f301210925 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr111965-2.c @@ -0,0 +1,5 @@ +/* PR preprocessor/111965 + { dg-do preprocess } + { dg-options "-fdebug-cpp -fno-debug-cpp" } + { dg-final { scan-file-not pr111965-2.i "P:;F:;" } } */ +int x;